我是Spock的新手,并仔细阅读他们的在线文档.我有一个测试用例,我需要验证我的fixture与非模拟协作者的交互不会产生异常:
class FizzSpec extends Specification {
def "no exception thrown when we hail buzz"() {
given:
Fizz fixture = new Fizz()
Buzz buzz = new Buzz("YES", true, "Garble barb") // A non-mock!
when:
fixture.hail(buzz)
// TODO: How to verify the hail didn't produce an exception?
// then:
// thrown() == null
}
}
Run Code Online (Sandbox Code Playgroud)
关于如何实现这一点的任何想法?
| 归档时间: |
|
| 查看次数: |
6776 次 |
| 最近记录: |