Skip to content

Commit 6034255

Browse files
committed
Fix ConsoleLauncherTests failure on JDK 22
Recent pull requests have been failing on OpenJDK 22 in builds of GitHub Actions Workflow "Cross-Version". Latest successful builds used openjdk-22-ea+7_linux-x64_bin.tar.gz, while builds with openjdk-22-ea+8_linux-x64_bin.tar.gz and openjdk-22-ea+9_linux-x64_bin.tar.gz have been failing. Output was changed in commit [1] to include italics and underline formatting. Tests fail under Java 22, because they expect only the plain text, and not the formatting. This failure seems to happen on openjdk-22-ea+9_linux-x64_bin due to recent change in JDK: "8308591: JLine as the default Console provider".[2], which was released as part of jdk-22+8.[3] An alternative solution would be to override this default behavior of JDK with Java option `-Djdk.console=java.base`, as mentioned in release notes.[3] [1] f916512 (Fix some tests, 2023-04-26) [2] https://bugs.openjdk.org/browse/JDK-8308591 https://bugs.java.com/bugdatabase/view_bug?bug_id=8308591 openjdk/jdk@bae2247 [3] https://jdk.java.net/22/release-notes openjdk/jdk@jdk-22+7...jdk-22+8
1 parent 59141b9 commit 6034255

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ void displayBanner(String command) {
4646
var consoleLauncher = new ConsoleLauncher((__, ___) -> null, printSink, printSink);
4747
consoleLauncher.run(command);
4848

49-
assertThat(stringWriter.toString()).contains(
50-
"Thanks for using JUnit! Support its development at https://junit.org/sponsoring");
49+
String output = stringWriter.toString();
50+
assertThat(output).contains("Thanks for using JUnit!");
51+
assertThat(output).contains("Support its development at");
52+
assertThat(output).contains("https://junit.org/sponsoring");
5153
}
5254

5355
@ParameterizedTest(name = "{0}")

0 commit comments

Comments
 (0)