RFR: 8274274: Update JUnit to version 5.8.1 [v6]

Kevin Rushforth kcr at openjdk.java.net
Sat Nov 20 16:03:13 UTC 2021


On Mon, 15 Nov 2021 22:37:09 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> I've added JUnit 5 as a test dependency and made sure that the JUnit 4 tests still work.  Also added a single JUnit 5 tests, and confirmed it works.
>> 
>> I've updated the Eclipse project file for the base module only.
>
> John Hendrikx has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Fix white space error
>  - Allow apiguardian as dependency

I was able to do a build / test on my local build machine using locally cached jar files. In order for this to work, I needed to add an explicit list of dependencies in `build.gradle`. See comments inline.

Once you make the requested updates, I'll do a CI test build.

build.gradle line 1948:

> 1946:     dependencies {
> 1947:         testImplementation group: "junit", name: "junit", version: "4.13.2"
> 1948:         testImplementation group: "org.junit.jupiter", name: "junit-jupiter", version: "5.8.1"

We need an explicit list of dependencies here, rather than relying on the maven pom files to bring them in. This is needed for our internal builds where we only host a snapshot of the jar files and not the pom files. Also, it better documents the dependencies. After adding the following to my local build, it all works now:


testImplementation group: "org.junit.jupiter", name: "junit-jupiter-api", version: "5.8.1"
testImplementation group: "org.hamcrest", name: "hamcrest-core", version: "1.3"
testRuntimeOnly group: "org.junit.jupiter", name: "junit-jupiter-engine", version: "5.8.1"
testRuntimeOnly group: "org.junit.jupiter", name: "junit-jupiter-params", version: "5.8.1"
testRuntimeOnly group: "org.junit.platform", name: "junit-platform-commons", version: "1.8.1"
testRuntimeOnly group: "org.junit.platform", name: "junit-platform-engine", version: "1.8.1"
testRuntimeOnly group: "org.apiguardian", name: "apiguardian-api", version: "1.1.2"
testRuntimeOnly group: "org.opentest4j", name: "opentest4j", version: "1.2.0"

build.gradle line 1951:

> 1949:         testRuntimeOnly group: "org.junit.vintage", name: "junit-vintage-engine", version: "5.8.1"
> 1950: 
> 1951:          if (BUILD_CLOSED && DO_JCOV)  {

Minor: you added an extra space of indentation (which is why this line is showing up in the diff).

build.gradle line 2041:

> 2039: 
> 2040:     dependencies {
> 2041:         testImplementation group: "junit", name: "junit", version: "4.13.2"

This isn't needed and should be removed (rather than updating it).

build.gradle line 2117:

> 2115: 
> 2116:     dependencies {
> 2117:         stubImplementation group: "junit", name: "junit", version: "4.13.2"

This isn't needed and should be removed (rather than updating it).

modules/javafx.base/src/test/java/test/JUnit5Test.java line 34:

> 32:     @Test
> 33:     void junit5ShouldWork() {
> 34:         System.err.println("JUnit 5 test working!");

I recommend adding a trivial assert here (e.g., `assertNotNull(this)` or similar).

-------------

PR: https://git.openjdk.java.net/jfx/pull/633


More information about the openjfx-dev mailing list