I want to write spock test using Stub I have a class Site with two methods
getText()
getTitle()
So I write
MyTestClass{
Site site
def "test()"{
site = Stub(Site){
getText()<<"text"
getTitle()<<"title"}
...
}
}
And the error
groovy.lang.MissingMethodException: No signature of method:
com.example.MyTestClass.getText() is applicable for argument types: () values: []
Why Spock thinks that the getText() is part of MyTestClass, but not from Site?
Turn the arrows the other way, e.g.
getText() >> "text"
:)