2010-12-06 7 views
0

이클립스에서 통합 테스트를 실행하는 동안 동일한 널 포인터 예외가 발생합니다. 명령 프롬프트에서 동일한 테스트를 실행할 때 테스트가 통과됩니다. 이전에 테스트는 또한 일식으로 전달되었지만 지금 내가 문제를이클립스에서 통합 테스트를 실행하는 동안 null 포인터 예외가 발생합니다.

오류가 발생하는 것입니다 :

java.lang.NullPointerException 
    at java.io.FileInputStream.<init>(FileInputStream.java:103) 
    at java.io.FileInputStream.<init>(FileInputStream.java:66) 
    at java.io.FileReader.<init>(FileReader.java:41) 
    at com.cmates.AbstractDBUnitSupport.getReader(AbstractDBUnitSupport.java:465) 
    at com.cmates.AbstractDBUnitSupport.executeSqlFile(AbstractDBUnitSupport.java:329) 
    at com.cmates.authorization.RegistrantProvisionsServiceImplIntTest.dropTables(RegistrantProvisionsServiceImplIntTest.java:96) 
    at com.cmates.authorization.RegistrantProvisionsServiceImplIntTest.tearDown(RegistrantProvisionsServiceImplIntTest.java:105) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) 
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) 
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) 
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236) 
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45) 
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) 
+3

다음 번에 자신에게이 질문을하십시오. "코드를 표시하지 않을 때 다른 사람들이 내 코드에 어떤 차이가 있는지 어떻게 알 수 있습니까?" – Bozho

+0

문제는 코드와 관련이 없다고 생각합니다. 생각 나는 명령 프롬프트. 나는 이클립스의 설정에 문제가있는 것 같아. 내가 이클립스에서 직접 실행할 때만 테스트 케이스가 실패한다. –

+0

코드와 관련이없는 프로그래밍 문제는 거의 본 적이 없다;) – Bozho

답변

0

FileInputStream의 생성자는 NullPointerExceptionFile 매개 변수 인 경우 null가 발생합니다. 그것이 당신이 검색을 시작해야하는 곳입니다. "테스트 환경"에서 해결할 수없는 SQL 파일을 읽고 싶을 수도 있습니다.

+0

thanxs. 문제는 IP 주소가 바뀌었고 내 local.prop 파일에서 변경되지 않았다. –

0

RegistrantProvisionsServiceImplIntTest.dropTables() 메서드는 SQL 파일을 실행하려고하지만 찾을 수 없습니다. Eclipse에서 프로젝트를 새로 고쳐야 할 수 있습니다. 또한 액세스 권한 문제 일 수 있습니다.

0

잘못 초기화 된 데이터베이스 연결을 사용하려고합니다.

JUnit에서 "Setup + teardown"기능을 올바르게 사용 하시겠습니까?

관련 문제