내가 간단한 Grails의 서비스가 테스트IllegalStateException이는
class SearchServiceSpec extends Specification implements ServiceUnitTest<SearchService>{
def setup() {
}
def cleanup() {
}
void "test something"() {
expect:
service.doSomething() == 10
}
}
내가 테스트를 실행하면, 다음과 같은 예외가 :
누구나 이것이 의미하는 것이 무엇인지 아시나요?
doSomething
을 getSomething
으로 변경 한 후 이상한 것이 작동하고 service.something
을 수행합니다.
다음 버전이 있습니다. | Grails 버전 : 3.3.0 | 그루비 버전 : 2.4.11 | JVM 버전 : 1.8.0_60
'get'메소드를 사용하는 것은 문서에있는 것과 정확히 같습니다. https://testing.grails.org/latest/guide/index.html#unitTestingServices 클래스에 @Mock() 주석을 추가하고 GORM을 연결하고 작동해야합니다. (Grails 3.3 이전). 3.3에서 어떻게 변경했는지 모르겠습니다. – bassmartin