6

I am using surifire, failsafe, mockito and powermock. Where ever I tried I got like power mock is not support for Java 11.

I have tried with the latest version of surefire also but it throws exception like. (build success if I skip the test cases)

Time elapsed: 0 sec <<< ERROR! org.objenesis.ObjenesisException: java.lang.reflect.InvocationTargetException

Caused by: java.lang.reflect.InvocationTargetException Caused by: java.lang.IllegalAccessError: class jdk.internal.reflect.ConstructorAccessorImpl loaded by org.powermock.core.classloader.MockClassLoader @77cf3f8b cannot access jdk/internal/reflect superclass jdk.internal.reflect.MagicAccessorImpl

Which version will resolve this issue? In order to support Java 11, maven-compiler-plugin 3.6.0.

Jacob G.
  • 28,856
  • 5
  • 62
  • 116
VG__
  • 533
  • 2
  • 6
  • 16
  • 1
    See https://stackoverflow.com/questions/52966897/powermock-java-11 – gjoranv Jan 24 '19 at 16:13
  • So that will work for @RunWith(PowerMockRunner.class).it need to be add as a separate statement right. – VG__ Jan 25 '19 at 00:04
  • I have used like this @RunWith(PowerMockRunner.class) @PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"}) still I faces the same issue java.lang.reflect.InvocationTargetException – VG__ Jan 25 '19 at 06:03
  • Did you fix it @VG__? Im on the same boat. – Bhargav Kumar R Aug 25 '20 at 16:42
  • Not sure, but most searching says power mock no longer ( no newer versions) for java... java 11 we need to change some other mocj like jmock. – VG__ Oct 11 '20 at 19:28

0 Answers0