I am trying to create a closure matcher for Fest with Groovy (2.1.6) like this:
def matcherLabel = [ isMatching: { JLabel label -> /* do something */ } ] as GenericTypeMatcher<JLabel>
GenericTypeMatcher is an abstract class with one method only to implement (isMatching (T t))
but I get this error:
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Error casting map to org.fest.swing.core.GenericTypeMatcher, Reason: null
at org.codehaus.groovy.runtime.DefaultGroovyMethods.asType(DefaultGroovyMethods.java:7562)
Is it possible what I am trying to do?