My project is a Wildfly 13 application which uses Mockito testing library. The app is not using Java 9 module structure. As long as the server ran on Java 8 the tests worked
As of Java 11, WildFly 14+ and Mockito 2.23.0+, adding jdk.unsupported module dependency to your WAR solves the problem. You can do this in two ways:
META-INF/MANIFEST.MFAdd the following line to META_INF/MANIFEST.MF of your WAR archive:
Dependencies: jdk.unsupported
Note that the file must end with a new line or carriage return.
Here is how you'd typically do it with ShrinkWrap/Arquillian:
@Deployment
public static WebArchive createDeployment() {
return ShrinkWrap.create(WebArchive.class, "my-app.war")
.addPackages(true, Mockito.class.getPackage(), Objenesis.class.getPackage(), ByteBuddy.class.getPackage())
.addAsManifestResource(new StringAsset("Dependencies: jdk.unsupported\n" /* required by Mockito */), "MANIFEST.MF");
}
WEB-INF/jboss-deployment-structure.xmlAdd the following content to WEB-INF/jboss-deployment-structure.xml of your WAR archive: