0

I get this error while trying to run a JUnit Test on eclipse Oxygen Using Ibm's jdk8.

Is there any known bug in this version of jdk? How can I fix/avoid it?


Assertion failed!

Bakri Bitar
  • 1,543
  • 18
  • 29

2 Answers2

3

Seems like the unit test uses PowerMock, which does not currently support IBM JDK.

PowerMock tries to load an agent via HotSpot Attach Mechanism, but it should use J9 attach mechanism instead.

See the following issues for details:

apangin
  • 92,924
  • 10
  • 193
  • 247
  • No we don't use PowerMock. But we use JMockit, Mockrunner and EasyMock. – Bakri Bitar Jan 15 '20 at 08:36
  • @BakriBitar Anyway, this or the other mocking library relies on the bytecode instrumentation. You need to include the agent JAR at JVM startup with `-agentpath` option. Otherwise the library tries to load the agent JAR at runtime using HotSpot Dynamic Attach Mechanism and fails, since J9 attach mechanism works differently. – apangin Jan 15 '20 at 09:26
0

Worked by adding the Mocking-Library path as VM Argument to the JRE as already stated by apangin.

To do that:

WindowPreferencesJavaInstalled JREs: select JDK, edit it and add the following to Default VM Arguments:

-javaagent:<YOUR_M2_REPO_PATH>/org/jmockit/jmockit/1.9/jmockit-1.9.jar

enter image description here

Bakri Bitar
  • 1,543
  • 18
  • 29