I am getting below exception when i am trying to runing the Junit testcases. If i am changing the classpath entry order it is working fine but the Jococo coverage is not working.It is getting hanging. Can any please help to fix this issue.
<classpathentry kind="lib" path="libt/junit-4.8.2.jar"/>
<classpathentry kind="lib" path="lib/jmockit.jar"/>
java.lang.IllegalStateException: JMockit wasn't properly initialized; check that jmockit.jar precedes junit.jar in the classpath (if using JUnit; if not, check the documentation)
at com.amica.bc.testutil.BillingCenterTestUtil$1.<init>(BillingCenterTestUtil.java:18)
at com.amica.bc.testutil.BillingCenterTestUtil.setCurrentUserName(BillingCenterTestUtil.java:18)
at amica.util.logging.TestAmicaGWLogger.setUp(TestAmicaGWLogger.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
SYMPTOM: Error when run maven with Jmockit and junit into java project.
MESSAGE: JMockit wasn't properly initialized; check that jmockit.jar precedes junit.jar in the classpath (if using JUnit; if not, check the documentation)
CAUSES:
Wrong configured in POM.xml file. Jmockit dependencyis is after of junit.
SOLUTIONS:
Edit POM.xml file. The jmockit.jar should be precedes junit.jar then jmockit dependency should be before of junit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With