You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when using GroovySpy() with an obkject that has propertyMissing() implemented, attempts to access dynamic properties results in an exception
To Reproduce
packageexampleimportspock.lang.SpecificationclassTestClass {
defpropertyMissing(Stringname) {
return name
}
}
classTesterSpecextendsSpecification {
def'No Spy'() {
given: 'an instance'TestClass sut =newTestClass()
expect: 'property to be returned'
sut.bob =='bob'
}
// This does not workdef'Spy'() {
given: 'a spied instance'TestClass sut =GroovySpy()
expect: 'property to be returned'
sut.bob =='bob'
}
}
Expected behavior
Both test should pass
Actual behavior
second test fails with
ondition failed with Exception:
sut.bob == 'bob'
| |
| groovy.lang.MissingMethodException: No signature of method: example.TestClass.getBob() is applicable for argument types: () values: []
| Possible solutions: getAt(java.lang.String), getClass(), notify(), every(), grep()
| at example.TesterSpec.Spy(TesterSpec.groovy:27)
example.TestClass$$EnhancerByCGLIB$$9a1d9323@7e0f56d8
Java version
Corretto-11
Buildtool version
------------------------------------------------------------
Gradle 6.7
------------------------------------------------------------
Build time: 2020-10-14 16:13:12 UTC
Revision: 312ba9e0f4f8a02d01854d1ed743b79ed996dfd3
Kotlin: 1.3.72
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM: 11.0.14.1 (Amazon.com Inc. 11.0.14.1+10-LTS)
OS: Mac OS X 13.6 x86_64
What operating system are you using
Mac
Dependencies
Using Spock 1.3-groovy-2.4 with Groovy 2.4.12
Additional context
This is in a very specific setup, so on old version of spock/Groovy but I am told it is recreatable with latest version
The text was updated successfully, but these errors were encountered:
Describe the bug
when using GroovySpy() with an obkject that has propertyMissing() implemented, attempts to access dynamic properties results in an exception
To Reproduce
Expected behavior
Both test should pass
Actual behavior
second test fails with
Java version
Corretto-11
Buildtool version
What operating system are you using
Mac
Dependencies
Using Spock 1.3-groovy-2.4 with Groovy 2.4.12
Additional context
This is in a very specific setup, so on old version of spock/Groovy but I am told it is recreatable with latest version
The text was updated successfully, but these errors were encountered: