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
{{ message }}
Repository navigation
MissingMethodException in 0.13.0 when setting input field value with value() #422
I get this exception when trying to set an input field's value with the .value() method in a company project I'm working on. I tried to reproduce the issue in a public project to give a reproducible example but it works fine in the public project, which is inconvenient.
| groovy.lang.MissingMethodException: No signature of method: java.util.HashMap$Values.minus() is applicable for argument types: (java.util.ArrayList) values: [[input, select, textarea]]
Possible solutions: min(), min(groovy.lang.Closure), min(java.util.Comparator), find(), find(), unique()
at geb.navigator.NonEmptyNavigator.setInputValues(NonEmptyNavigator.groovy:704)
at geb.navigator.NonEmptyNavigator.value(NonEmptyNavigator.groovy:448)
at geb.content.TemplateDerivedPageContent.value(TemplateDerivedPageContent.groovy:33)
In the past I've been bitten by HashMap.values() not being a normal collection type (List, Set, etc.) - it's a special class Values inside HashMap that doesn't have all the same collection methods as some of the more common collection classes.
From looking at what methods the Values class does have, it looks like it has the removeAll() method which could be a good substitute in this case.
I haven't been able to reproduce the issue in a test inside Geb core yet, but I was able to reproduce it in a public Grails2 project: https://github.com/craigatk/geb-example
I think I know why I'm getting this exception in my Grails2 apps but can't recreate in Geb core - different Groovy versions.
I added a test to the geb-grails plugin that calls .value() and messed around with specifying different Groovy versions in geb-grails.gradle. Currently project.groovyVersion is in there, which is 2.4.5. When I changed the Groovy version to what ships with Grails 2.4.2 (Groovy 2.3.7), then I got the exception. I tried some different versions and any Groovy version >= 2.4.0 works fine so they must have added more methods for that HashMap.Values class in Groovy 2.4.0
Now that I have a way to reproduce and test the fix I will work on a PR to fix it to work with Groovy < 2.4
Thanks for reporting and looking into this, @craigatk. I'm a bit busy tonight and tomorrow so I might not be able to attend to it before Friday, sorry about that. Looking forward to the PR, though.
Activity
craigatk commentedon Feb 17, 2016
I'll try to reproduce the exception with a test in Geb core and if I can I'll submit a PR to fix it.
craigatk commentedon Feb 17, 2016
I haven't been able to reproduce the issue in a test inside Geb core yet, but I was able to reproduce it in a public Grails2 project: https://github.com/craigatk/geb-example
craigatk commentedon Feb 17, 2016
I think I know why I'm getting this exception in my Grails2 apps but can't recreate in Geb core - different Groovy versions.
I added a test to the geb-grails plugin that calls .value() and messed around with specifying different Groovy versions in geb-grails.gradle. Currently project.groovyVersion is in there, which is 2.4.5. When I changed the Groovy version to what ships with Grails 2.4.2 (Groovy 2.3.7), then I got the exception. I tried some different versions and any Groovy version >= 2.4.0 works fine so they must have added more methods for that HashMap.Values class in Groovy 2.4.0
Now that I have a way to reproduce and test the fix I will work on a PR to fix it to work with Groovy < 2.4
erdi commentedon Feb 17, 2016
Thanks for reporting and looking into this, @craigatk. I'm a bit busy tonight and tomorrow so I might not be able to attend to it before Friday, sorry about that. Looking forward to the PR, though.
craigatk commentedon Feb 17, 2016
@erdi no problem, looking into it by the weekend is still quick! :)
I created a PR with a fix here apache/groovy-geb#115
If there's anything I should change in the PR or do differently, just let me know. Thanks!
erdi commentedon Feb 17, 2016
That was quick, thanks. I will comment on the PR.