JPassport icon indicating copy to clipboard operation
JPassport copied to clipboard

Update JUnit 5 version

Open sormuras opened this issue 3 years ago • 6 comments
trafficstars

The README says:

JUnit 5.4.2 (later versions of JUnit do not play nice with modules yet)

What are the issues here?

IIRC, we introduced module descriptors around JUnit 5.5 ... 🤔

sormuras avatar Mar 09 '22 21:03 sormuras

The biggest issue I was having is that I had to split the tests into a separate sub project because maven (and JUnit?) were unhappy about there being a module-info in both the main and tests folders. I'll try this again and get more info.

boulder-on avatar Mar 09 '22 22:03 boulder-on

Yes, in-module testing is still not there, yet. Extra-module testing is the better way to keep modular boundaries intact, anyway.

This Maven plugin might come in handy: https://github.com/sormuras/junit-platform-maven-plugin It supports a module-info.test file for specifying module system related command-line options for in-module testing.

sormuras avatar Mar 10 '22 17:03 sormuras

I'm pretty certain I'm missing something - I don't use maven much.

If I use JUnit 5.4.2 like this in my pom.xml then I can run tests via maven.

<dependency>
   <groupId>org.junit.jupiter</groupId>
   <artifactId>junit-jupiter-api</artifactId>
   <version>5.4.2</version>
</dependency>
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-engine</artifactId>
    <version>5.4.2</version>
</dependency>

If I change to JUnit 5.8.2 then when I run my tests via maven I get

java.lang.IllegalAccessError: class org.junit.platform.launcher.core.ServiceLoaderRegistry (in unnamed module @0x23a5fd2) cannot access class org.junit.platform.commons.logging.LoggerFactory (in module org.junit.platform.commons) because module org.junit.platform.commons does not export org.junit.platform.commons.logging to unnamed module @0x23a5fd2

Any pointers on getting past this error? I have not enabled the plugin you've pointed to at this point.

boulder-on avatar Mar 13 '22 23:03 boulder-on

Download the source and run the maven build.

I couldn't get the project to build by running mvn verify. What are the steps I need follow?

Would be awesome to add an Actions-based CI workflow this project, in order to document those build steps in "code" and run it against the lastest-and-greatest Panama builds.

sormuras avatar Mar 17 '22 04:03 sormuras

Sorry about that. You'll need to set java_home to point to Java 17. I just uploaded the library required to test on Linux, so mvn verify will work on windows. I'm having trouble loading the .so on linux.

boulder-on avatar Mar 19 '22 17:03 boulder-on

I've added a CI, and fixed the tests in Linux.

I have not set up the CI to run against the most recent panama builds though. I still need to decide the best way to handle this (and I didn't see how to reference panama builds in the maven.yml). The Java 18 API has changed again, the existing code will not compile. I have the required fixes, just not checked in.

I've been trying to decide if I should have a separate branch for Java 18 and 17. I'd like to support 17 for as long as possible since it's going to be around a while and it's the most likely thing people are going to adopt. A multi-release jar seems like a reasonable idea. It's just details on setting up the pom.xml properly to build and test both streams.

boulder-on avatar Mar 20 '22 21:03 boulder-on