I am using Groovy with JUnit to test Java code.
I need to test the foo() method, which takes a java.util.function.Function value
public void foo(Function<Foo,Bar> func){ return null; }
In my normal code, I call foo , passing the method bar reference of the bar ie method.
foo(mybar::bar)
How can I test this feature in Groovy elegantly?
Using:
mybar.&bar
gives a groovy.lang.Closure<...> , which is incompatible with java.util.function.Function .
How else can I achieve this?
source share