2011-02-28 5 views
0

나는 내 Grails의 프로젝트에 대한 UrlMappingsTest을 만들려고 해요, 나는 다음과 같은 예외를 받고 있어요 :UrlMappingsTests - 테스트 유형 '통합'에서 클래스를로드 할 수 없습니까?

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]  

      ^

답변

0

당신이 GrailsUrlMappingsTestCasesource 보면 그것이 않기 때문에 당신은 필요하지 않습니다 (당신이 아마 의심으로) static mappings = UrlMappings을 것을 볼 수 있습니다 정적 매핑 변수를 지정하지 않은 경우에는 기본적으로이 속성이 사용됩니다. 줄을 주석으로 남겨 둘 때 java.lang.RuntimeException: Could not load class in test type 'integration' 아래에서 중첩 예외가 발생합니까? 전체 stacktrace 게시, 작동합니다. 어떤 grails 버전을 사용하고 있습니까?

+0

없이 실행할 때 클래스를 찾을 수 없습니다. 1.3.7을 사용하고 있습니다. –

+0

흠. 1.3.6에서 제 테스트를하고 있습니다. 주석 처리했을 때 전체 스택 추적을 게시 할 수 있습니까? – Melv

+0

새로운 프로젝트를 시작했는데 1.3.7에서 실패합니다. 나는 이것이 회귀의 용의자라고 생각한다. –

관련 문제