You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary
When running the code coverage tool in standalone mode, for some applications I get an error saying mockit/internal/state/TestRun$1 cannot be found.
It quite possibly is related to two classes referencing each other.
Code coverage is still generated but I believe the classes that caused the error do not get any data associated with them.
If I add the following to the coverage/pom.xml file it takes care of the error, but I assume these files are not meant to be needed:
Run the application from the command line with the following command (with the paths corrected to match your own system):
"C:\Program Files\Java\jdk1.8.0_60\bin\java.exe" -classpath ./target/TestApp-1.0-SNAPSHOT.jar -javaagent:C\jmockit121\jmockit1-master\coverage\target\jmockit-coverage-1.21.jar -Dcoverage-outputDir=./CodeCoverageReports -Dcoverage-classes=com.qhrtech.emr.qa.* -Dcoverage-metrics=line -Dcoverage-output=html-nocp com.qhrtech.emr.qa.testapp.TestApp
*The error is printed to the console immediately.
Versions
jmockit-coverage: 1.21 (GitHub 4e9bdf3) (compiled from source as per the instructions on GitHub)
Maven: 3.3.3
Java: JDK 1.8.0 u60
Stack trace
[java] java.lang.NoClassDefFoundError: mockit/internal/state/TestRun$1
[java] at mockit.internal.util.ClassLoad.loadClass(ClassLoad.java:49)
[java] at mockit.internal.util.ClassLoad.loadByInternalName(ClassLoad.java:31)
[java] at mockit.internal.util.ClassLoad.getSuperClass(ClassLoad.java:146)
[java] at mockit.internal.util.ClassLoad.actualSuperClass(ClassLoad.java:177)
[java] at mockit.internal.util.ClassLoad.whichIsSuperClass(ClassLoad.java:161)
[java] at mockit.external.asm.ClassWriter.getCommonSuperClass(ClassWriter.java:1694)
[java] at mockit.external.asm.ClassWriter.getMergedType(ClassWriter.java:1661)
[java] at mockit.external.asm.Frame.merge(Frame.java:1426)
[java] at mockit.external.asm.Frame.merge(Frame.java:1325)
[java] at mockit.external.asm.MethodWriter.visitMaxs(MethodWriter.java:1475)
[java] at mockit.external.asm.MethodVisitor.visitMaxs(MethodVisitor.java:804)
[java] at mockit.external.asm.ClassReader.readCode(ClassReader.java:1554)
[java] at mockit.external.asm.ClassReader.readMethod(ClassReader.java:1017)
[java] at mockit.external.asm.ClassReader.accept(ClassReader.java:693)
[java] at mockit.external.asm.ClassReader.accept(ClassReader.java:506)
[java] at mockit.coverage.modification.ClassModification.modifyClassForCoverage(ClassModification.java:142)
[java] at mockit.coverage.modification.ClassModification.modifyClassForCoverage(ClassModification.java:217)
[java] at mockit.coverage.modification.ClassModification.modifyClass(ClassModification.java:192)
[java] at mockit.coverage.CodeCoverage.transform(CodeCoverage.java:127)
[java] at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
[java] at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
[java] at java.lang.ClassLoader.defineClass1(Native Method)
[java] at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
[java] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[java] at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
[java] at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[java] at com.qhrtech.emr.qa.testapp.TestApp.main(TestApp.java:15)
[java] Caused by: java.lang.ClassNotFoundException: mockit.internal.state.TestRun$1
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[java] ... 34 more
[java] JMockit: Coverage report written to C:\QA\SVNWorkingCopy\accuro-2015.03\TestApp\CodeCoverageReports
Source Code
I have used a simplified application with three classes.
===TestApp.java===
Summary
When running the code coverage tool in standalone mode, for some applications I get an error saying mockit/internal/state/TestRun$1 cannot be found.
It quite possibly is related to two classes referencing each other.
Code coverage is still generated but I believe the classes that caused the error do not get any data associated with them.
If I add the following to the coverage/pom.xml file it takes care of the error, but I assume these files are not meant to be needed:
Also, strangely, if I compile my project with a target of 1.6, I do not get the error. (With 1.7 or 1.8 I do.) i.e.
Steps to reproduce
"C:\Program Files\Java\jdk1.8.0_60\bin\java.exe" -classpath ./target/TestApp-1.0-SNAPSHOT.jar -javaagent:C\jmockit121\jmockit1-master\coverage\target\jmockit-coverage-1.21.jar -Dcoverage-outputDir=./CodeCoverageReports -Dcoverage-classes=com.qhrtech.emr.qa.* -Dcoverage-metrics=line -Dcoverage-output=html-nocp com.qhrtech.emr.qa.testapp.TestApp
*The error is printed to the console immediately.
Versions
jmockit-coverage: 1.21 (GitHub 4e9bdf3) (compiled from source as per the instructions on GitHub)
Maven: 3.3.3
Java: JDK 1.8.0 u60
Stack trace
Source Code
I have used a simplified application with three classes.
===TestApp.java===
===UserManager.java===
===PasswordManager.java===
===pom.xml===
The text was updated successfully, but these errors were encountered: