【发布时间】:2014-11-05 03:39:29
【问题描述】:
为什么以下测试失败并显示“调用太少”,而不是在调用模拟方法之前在 do 方法中引发的实际异常?
有没有办法改变这种行为?
@Test
def "Should Create"() {
when: "We do stuff"
this.someStuff.do()
then: "Should not get exception"
notThrown(Exception)
and: "Should send mail"
1 * mailSession.send(_, _, _, _, _, _, _)
}
【问题讨论】:
-
信息太少,无法诊断。
标签: java unit-testing groovy spock