【发布时间】:2015-09-24 16:08:01
【问题描述】:
此测试仅在测试条件时才有效。当与交互测试混合时,它会失败。
class Test extends Specification {
class Inner {
public String greet() {
return "hello"
}
}
def "simple test"() {
given:
def inner = Mock(Inner)
inner.greet() >> { "hi" }
when:
def msg = inner.greet()
then:
1 * inner.greet() // Below will pass when this line commented out.
msg == "hi"
}
}
删除交互测试后测试将通过。
Condition not satisfied:
msg == "hi"
| |
| false
null
【问题讨论】:
标签: spock