我正在尝试为我的 grails 项目创建 UrlMappingsTest,但出现以下异常:
java.lang.RuntimeException: Could not load class in test type 'integration'
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
我的课很简单,我试着照着做。这是怎么回事?
import grails.test.GrailsUrlMappingsTestCase
class UrlMappingTests extends GrailsUrlMappingsTestCase {
// static mappings = UrlMappings
void testForwardingUrls(){
assertForwardUrlMapping( "/rest/users/stefan/files", controller: "file", action: "allFiles" );
}
}
在未注释静态行的情况下,我得到
[groovyc] You attempted to reference a variable in the binding or an instance variable from a static context.
[groovyc] You misspelled a classname or statically imported field. Please check the spelling.
[groovyc] You attempted to use a method 'UrlMappings' but left out brackets in a place not allowed by the grammar.
[groovyc] @ line 7, column 21.
[groovyc] static mappings = UrlMappings
[groovyc]
^