jmockit i am using in junit tests to mock object. jmockit version 1.24 is working fine with java 8. And then i upgraded from java 8 to java 11 then test cases are failing with error Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.001 s <<< FAILURE! - in com.accurev.gitserver.fw.parsers.ValidationParserTest com.accurev.gitserver.fw.parsers.ValidationParserTest Time elapsed: 0.001 s <<< ERROR! java.lang.NoClassDefFoundError: mockit.MockUp at com.accurev.gitserver.fw.parsers.ValidationParserTest.setUp(ValidationParserTest.java:50)
It's telling NoClassDefFoundError but if jmockit jar is there in maven dependency and in classpath also MockUp.java class is there.
<junit.jupiter.version>5.6.0</junit.jupiter.version>
<junit.platform.version>1.5.2</junit.platform.version>
<jmockit.version>1.49</jmockit.version>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-runner -->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit.platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.21.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>2.23.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>${jmockit.version}</version>
</dependency>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
I tried updating the jmockit version from 1.24 to 1.45. But in latest verson they deprecated the tearDown() method to remove instance. So i commented it out where tearDown() method used as it is not necessary. But still failing with same above error like NoClassDefFoundError. Is jmockit plugin works with java 11. Is there any other things need to upgrade.