我想用Stub编写spock测试,我有一个类站点,它有两种方法
getText()
getTitle()所以我写
MyTestClass{
Site site
def "test()"{
site = Stub(Site){
getText()<<"text"
getTitle()<<"title"}
...
}
}和错误
groovy.lang.MissingMethodException: No signature of method:
com.example.MyTestClass.getText() is applicable for argument types: () values: []为什么斯波克认为getText()是MyTestClass的一部分,而不是Site
发布于 2014-12-08 16:00:05
将箭头转到另一个方向,例如getText() >> "text" :)
https://stackoverflow.com/questions/27361564
复制相似问题