次のように、Groovy (2.1.6) を使用して Fest のクロージャー マッチャーを作成しようとしています。
def matcherLabel = [ isMatching: { JLabel label -> /* do something */ } ] as GenericTypeMatcher<JLabel>
GenericTypeMatcher は、実装するメソッドが 1 つだけの抽象クラスです (isMatching (T t))。
しかし、私はこのエラーが発生します:
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)
私がやろうとしていることは可能ですか?