Skip to content

Commit 3b2ae59

Browse files
authored
Update JUnit (Pioneer) and Java (CI) (#818 / #826)
This PR updates the JUnit dependency for Pioneer from 5.10.2 to 5.11.2. It also updates the latest included Java version for CI from 21 to 23. Since the engine behavior changed with JUnit 5.11.0 (see junit-team/junit-framework@9af6ca4#diff-58dca140b6249c0d7f76a8056994eb6762b71bd2f79cc28106e5391d16d23245), some assertions are updated as well. Closes: #818 PR: #826
1 parent 304b325 commit 3b2ae59

4 files changed

Lines changed: 29 additions & 12 deletions

File tree

.github/workflows/build.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ jobs:
8383
- name: Set up Java
8484
uses: actions/setup-java@v4
8585
with:
86+
# Sonar needs Java 17
87+
# See https://docs.sonarsource.com/sonarcloud/appendices/scanner-environment/
8688
java-version: 17
8789
distribution: temurin
8890
- name: Cache SonarCloud results
@@ -130,8 +132,10 @@ jobs:
130132
timeout-minutes: 15
131133
strategy:
132134
matrix:
133-
java: [ 11, 17, 21 ]
134-
junit-version: [ '5.9.2', '5.10.0' ]
135+
# Pioneer, latest LTS, latest stable
136+
java: [ 11, 21, 23 ]
137+
# Pioneer = latest stable
138+
junit-version: [ '5.11.2' ]
135139
os: [ubuntu, macos, windows]
136140
name: with Java ${{ matrix.java }}, JUnit ${{ matrix.junit-version }} on ${{ matrix.os }}
137141
steps:
@@ -160,7 +164,7 @@ jobs:
160164
timeout-minutes: 15
161165
strategy:
162166
matrix:
163-
junit-version: [ '5.9.2', '5.10.0' ]
167+
junit-version: [ '5.11.2' ]
164168
os: [ubuntu, macos, windows]
165169
name: Experimental build with newest JDK early-access build and Gradle release candidate
166170
# Gradle doesn't work with JDK EA builds, so we launch it with a supported Java version,
@@ -179,7 +183,7 @@ jobs:
179183
- name: Set up supported Java
180184
uses: actions/setup-java@v4
181185
with:
182-
java-version: 17
186+
java-version: 23
183187
distribution: temurin
184188
- name: Set up Gradle
185189
uses: gradle/actions/setup-gradle@v3
@@ -216,10 +220,10 @@ jobs:
216220
- name: Set up Java
217221
uses: actions/setup-java@v4
218222
with:
219-
# we build the Javadoc with JDK 17 (for better results),
223+
# we build the Javadoc with JDK 23 (for better results),
220224
# so install that as well
221225
java-version: |
222-
21
226+
23
223227
11
224228
distribution: temurin
225229
- name: Set up Gradle

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ tasks {
304304
if (releaseBuild) {
305305
javadocTool.set(project.javaToolchains.javadocToolFor {
306306
// create Javadoc with the minimum Java version needed for our desired features (e.g. search)
307-
languageVersion.set(JavaLanguageVersion.of(21))
307+
languageVersion.set(JavaLanguageVersion.of(23))
308308
})
309309
}
310310

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
junitVersion=5.10.1
1+
junitVersion=5.11.2
22

33
# Ensure sufficient heap size, especially for Sonar.
44
org.gradle.jvmargs=-Xmx8g

src/test/java/org/junitpioneer/jupiter/resource/ResourcesTests.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.junit.jupiter.api.Nested;
2727
import org.junit.jupiter.api.Test;
2828
import org.junit.jupiter.api.extension.ParameterResolutionException;
29+
import org.junit.platform.commons.JUnitException;
2930
import org.junitpioneer.testkit.ExecutionResults;
3031

3132
@DisplayName("Resources extension")
@@ -76,7 +77,10 @@ void thenThrownExceptionIsPropagated() {
7677

7778
assertThat(results)
7879
.hasSingleFailedTest()
79-
.withExceptionInstanceOf(EXPECTED_THROW_ON_RF_CLOSE_EXCEPTION.getClass())
80+
.withExceptionInstanceOf(JUnitException.class)
81+
.hasMessage("Failed to close extension context")
82+
.cause()
83+
.isInstanceOf(EXPECTED_THROW_ON_RF_CLOSE_EXCEPTION.getClass())
8084
.hasMessage(EXPECTED_THROW_ON_RF_CLOSE_EXCEPTION.getMessage());
8185
}
8286

@@ -135,7 +139,10 @@ void thenThrownExceptionIsWrappedAndPropagated() {
135139

136140
assertThat(results)
137141
.hasSingleFailedTest()
138-
.withExceptionInstanceOf(EXPECTED_THROW_ON_R_CLOSE_EXCEPTION.getClass())
142+
.withExceptionInstanceOf(JUnitException.class)
143+
.hasMessage("Failed to close extension context")
144+
.cause()
145+
.isInstanceOf(EXPECTED_THROW_ON_R_CLOSE_EXCEPTION.getClass())
139146
.hasMessage(EXPECTED_THROW_ON_R_CLOSE_EXCEPTION.getMessage());
140147
}
141148

@@ -629,7 +636,10 @@ void thenThrownExceptionIsPropagated() {
629636

630637
assertThat(results)
631638
.hasSingleFailedContainer()
632-
.withExceptionInstanceOf(EXPECTED_THROW_ON_RF_CLOSE_EXCEPTION.getClass())
639+
.withExceptionInstanceOf(JUnitException.class)
640+
.hasMessage("Failed to close extension context")
641+
.cause()
642+
.isInstanceOf(EXPECTED_THROW_ON_RF_CLOSE_EXCEPTION.getClass())
633643
.hasMessage(EXPECTED_THROW_ON_RF_CLOSE_EXCEPTION.getMessage());
634644
}
635645

@@ -688,7 +698,10 @@ void thenThrownExceptionIsWrappedAndPropagated() {
688698

689699
assertThat(results)
690700
.hasSingleFailedContainer()
691-
.withExceptionInstanceOf(EXPECTED_THROW_ON_R_CLOSE_EXCEPTION.getClass())
701+
.withExceptionInstanceOf(JUnitException.class)
702+
.hasMessage("Failed to close extension context")
703+
.cause()
704+
.isInstanceOf(EXPECTED_THROW_ON_R_CLOSE_EXCEPTION.getClass())
692705
.hasMessage(EXPECTED_THROW_ON_R_CLOSE_EXCEPTION.getMessage());
693706
}
694707

0 commit comments

Comments
 (0)