Regression in Groovy: ClassCastException for closures not returning Boolean
See original GitHub issueCode:
Awaitility.await().until({ "something" })
1.7.0: passes 2.0.0: fails with
java.lang.String cannot be cast to java.lang.Boolean
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
at org.awaitility.core.CallableCondition$ConditionEvaluationWrapper.eval(CallableCondition.java:100)
at org.awaitility.core.ConditionAwaiter$ConditionPoller.run(ConditionAwaiter.java:215)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
AwaitilityGroovyBridge used runnable as Callable<Boolean>
while AwaitilityExtensionModule uses runnable as Callable
.
Implementing AwaitilityTrait
does not help, it seems that the extension module takes precedence. You need to change the closure to { "something" != null }
.
Release Notes don’t mention any breaking changes, so I consider this as a regression.
Also, please update examples from https://github.com/awaitility/awaitility/wiki/Groovy - they use deprecated classes.
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Why is this Groovy closure not returning the value that I expect?
The each method returns the same collection it was invoked on, so retVal is probably not the boolean "true", but is evaluated as...
Read more >Unable to use until(Runnable) with Clousure if awaitility ...
With awaitility-groovy module on a classpath it is not possible to use unitl(Runnable) with Groovy Closure, e.g..
Read more >Changelog for Groovy 1.1.0-unreleased
[GROOVY-1186] - NullpointerException occurs when unboxing boolean Java return type where no return value specified from Java interface implemented in Groovy ...
Read more >Changelog for Groovy 1.7.0
Properties unless getProperty() is overridden; [GROOVY-2583] - "object is not an instance of declaring class" thrown invoking a method on Groovy class, ...
Read more >Changelog for Groovy 4.0.0
[GROOVY-6097] - Using super.propertyName gives a MissingMethodException when the property is a boolean and uses the "isPropertyName" naming convention. [GROOVY- ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t see any problems with the current snapshot - I am closing this issue.
I found some problems if you had
AwaitilityTrait
in your code. My fixes in #73.