Friday, 15 February 2013

java - JUnit - Exception In Initializer Error -



java - JUnit - Exception In Initializer Error -

i'm trying test class static methods , i'm having error in line:

formreferencedatapopulator target = new formreferencedatapopulator();

and here's failure trace:

java.lang.exceptionininitializererror @ au.necdl.pexa.web.document.form.formreferencedatapopulatortest.<init>(formreferencedatapopulatortest.java:15) @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:39) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:27) @ java.lang.reflect.constructor.newinstance(constructor.java:513) @ org.junit.runners.blockjunit4classrunner.createtest(blockjunit4classrunner.java:187) @ org.junit.runners.blockjunit4classrunner$1.runreflectivecall(blockjunit4classrunner.java:236) @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:15) @ org.junit.runners.blockjunit4classrunner.methodblock(blockjunit4classrunner.java:233) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:68) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:47) @ org.junit.runners.parentrunner$3.run(parentrunner.java:231) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:60) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:229) @ org.junit.runners.parentrunner.access$000(parentrunner.java:50) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:222) @ org.junit.runners.parentrunner.run(parentrunner.java:300) @ org.eclipse.jdt.internal.junit4.runner.junit4testreference.run(junit4testreference.java:50) @ org.eclipse.jdt.internal.junit.runner.testexecution.run(testexecution.java:38) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:467) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:683) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.run(remotetestrunner.java:390) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.main(remotetestrunner.java:197) caused by: java.lang.runtimeexception: not locate bean of class [au.necdl.pexa.service.address.countryservice] @ au.necdl.pexa.core.pexacontextaware.getbean(pexacontextaware.java:65) @ au.necdl.pexa.web.document.form.formreferencedatapopulator.<clinit>(formreferencedatapopulator.java:29) ... 23 more

there couple of clues in stack trace point error is

a) exceptionininitializererror --> formreferencedatapopulatortest. indicates error happened during construction of object. exceptionininitializererror point fact exception occurred during static initialization block or variable

exceptionininitializererror signals unexpected exception has occurred in static initializer. exceptionininitializererror thrown indicate exception occurred during evaluation of static initializer or initializer static variable.

b) robby has pointed out in comment caused by: java.lang.runtimeexception: not locate bean of class [au.necdl.pexa.service.address.countryservice] shows error exact is.

java junit

No comments:

Post a Comment