I noticed this earlier when trying to make some assertions on a map.
Here is an example feature method with groovy-all:2.4.6 and spock-core:1.0-groovy-2.4 in gradle:
def "map containKey works as expected"() {
given:
def map = [myValue: 'hey', otherValue: 'helloagain']
expect:
with(map) {
size() == 2
containsKey('myValue')
containsKey('otherValue')
}
}
This fails with:
No signature of method: MySpec.containsKey() is applicable for argument types: (java.lang.String) values: [myValue]
groovy.lang.MissingMethodException: No signature of method: MySpec.containsKey() is applicable for argument types: (java.lang.String) values: [myValue]
at MySpec.map containKey works as expected(MySpec.groovy:59)
If I change both of the containsKey methods instead to use the implicit it, like it.containsKey it works as expected.
Is this expected behavior? Am I missing something about how the AST transformations happen?
I noticed this earlier when trying to make some assertions on a map.
Here is an example feature method with
groovy-all:2.4.6andspock-core:1.0-groovy-2.4in gradle:This fails with:
If I change both of the
containsKeymethods instead to use the implicitit, likeit.containsKeyit works as expected.Is this expected behavior? Am I missing something about how the AST transformations happen?