-
Notifications
You must be signed in to change notification settings - Fork 476
Closed
Description
Related, (but not the same as) #1256
When testing using a GroovyMock/GroovyStub/GroovySpy - isProperty() style getters are not respected, and only getProperty() is used.
Tested under org.spockframework:spock-core:1.3-groovy-2.4
To reproduce:
import spock.lang.Specification
class TesterSpec extends Specification {
static class Tester {
boolean isEnabled() {
return true
}
}
def 'Works'() {
given:
Tester x = new Tester()
expect:
x.enabled == true
}
def 'GroovySpy does not work Test'() {
given:
Tester x = GroovySpy(Tester)
expect:
x.enabled == true
}
def 'GroovyMock does not work either Test'(){
given:
Tester x = GroovyMock(Tester)
when:
x.enabled
then:
1 * x.isEnabled() >> true
}
def 'Mock works though Test'(){
given:
Tester x = Mock(Tester)
when:
x.enabled
then:
1 * x.isEnabled() >> true
}
}Metadata
Metadata
Assignees
Labels
No labels