I need to mock a GrailsControllerClass interface. Instance should have a static variable defined. The problem is that MockFor and StubFor don’t give you an option for adding static members. So, I write my abstract class that extends GrailsControllerClass
abstract class MyController implements GrailsControllerClass {
static myDefinition = [name:"item1", action:"action1"]
}
Now, MockFor and StubFor raise an error: groovy.lang.MissingMethodException: No signature of method: groovy.util.ProxyGenerator.instantiateAggregateFromBaseClass() is applicable for argument types: (java.lang.Class, null) values… which seems to be a reported bug: http://jira.codehaus.org/browse/GROOVY-3720 Alas, grails comes with groovy 1.6.
I do not want to make MyController a huge concrete class with empty method declarations. Any alternatives?