From c5567354c2556e772f8a0035ef7647161011d1c0 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 10 Sep 2023 12:37:53 +0200 Subject: [PATCH] Use same expected files for all JDK versions (cherry picked from commit e802db4643085cd1c609ac84aa3e635f98719d3f) --- .../standalone/expected-err-java8.txt | 21 ------------------- .../standalone/expected-out-java8.txt | 18 ---------------- .../support/tests/StandaloneTests.java | 16 ++++++++++---- 3 files changed, 12 insertions(+), 43 deletions(-) delete mode 100644 platform-tooling-support-tests/projects/standalone/expected-err-java8.txt delete mode 100644 platform-tooling-support-tests/projects/standalone/expected-out-java8.txt diff --git a/platform-tooling-support-tests/projects/standalone/expected-err-java8.txt b/platform-tooling-support-tests/projects/standalone/expected-err-java8.txt deleted file mode 100644 index 70a3db689cc9..000000000000 --- a/platform-tooling-support-tests/projects/standalone/expected-err-java8.txt +++ /dev/null @@ -1,21 +0,0 @@ ->> JAVA VERSION >> -.+ org.junit.platform.launcher.core.ServiceLoaderRegistry load -.+ Loaded LauncherInterceptor instances: .. -.+ org.junit.platform.launcher.core.ServiceLoaderRegistry load -.+ Loaded LauncherSessionListener instances: .. -.+ org.junit.platform.launcher.core.ServiceLoaderTestEngineRegistry loadTestEngines -.+ Discovered TestEngines: -- junit-jupiter .+ -- junit-vintage .+ -- junit-platform-suite .+ -.+ org.junit.platform.launcher.core.ServiceLoaderRegistry load -.+ Loaded PostDiscoveryFilter instances: .. -.+ org.junit.platform.launcher.core.ServiceLoaderRegistry load -.+ Loaded LauncherDiscoveryListener instances: .. -.+ org.junit.platform.launcher.core.ServiceLoaderRegistry load -.+ Loaded TestExecutionListener instances: .+ -.+ org.junit.platform.launcher.core.ServiceLoaderTestEngineRegistry loadTestEngines -.+ Discovered TestEngines: -- junit-jupiter .+ -- junit-vintage .+ -- junit-platform-suite .+ diff --git a/platform-tooling-support-tests/projects/standalone/expected-out-java8.txt b/platform-tooling-support-tests/projects/standalone/expected-out-java8.txt deleted file mode 100644 index 0a1cc1ecfba8..000000000000 --- a/platform-tooling-support-tests/projects/standalone/expected-out-java8.txt +++ /dev/null @@ -1,18 +0,0 @@ ->> TREE >> -Failures (2): ->> STACKTRACE >> - -Test run finished after \d+ ms -[ 11 containers found ] -[ 0 containers skipped ] -[ 11 containers started ] -[ 0 containers aborted ] -[ 11 containers successful ] -[ 0 containers failed ] -[ 10 tests found ] -[ 2 tests skipped ] -[ 8 tests started ] -[ 1 tests aborted ] -[ 5 tests successful ] -[ 2 tests failed ] - diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java index 33c5051de2c0..d4775c42f64c 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java @@ -21,6 +21,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; +import java.util.List; import de.sormuras.bartholdy.Result; import de.sormuras.bartholdy.jdk.Jar; @@ -390,8 +391,8 @@ void executeOnJava8() throws IOException { assertEquals(1, result.getExitCode(), () -> getExitCodeMessage(result)); var workspace = Request.WORKSPACE.resolve("standalone"); - var expectedOutLines = Files.readAllLines(workspace.resolve("expected-out-java8.txt")); - var expectedErrLines = Files.readAllLines(workspace.resolve("expected-err-java8.txt")); + var expectedOutLines = Files.readAllLines(workspace.resolve("expected-out.txt")); + var expectedErrLines = getExpectedErrLinesOnJava8(workspace); assertLinesMatch(expectedOutLines, result.getOutputLines("out")); assertLinesMatch(expectedErrLines, result.getOutputLines("err")); @@ -427,8 +428,8 @@ void executeOnJava8SelectPackage() throws IOException { assertEquals(1, result.getExitCode(), () -> getExitCodeMessage(result)); var workspace = Request.WORKSPACE.resolve("standalone"); - var expectedOutLines = Files.readAllLines(workspace.resolve("expected-out-java8.txt")); - var expectedErrLines = Files.readAllLines(workspace.resolve("expected-err-java8.txt")); + var expectedOutLines = Files.readAllLines(workspace.resolve("expected-out.txt")); + var expectedErrLines = getExpectedErrLinesOnJava8(workspace); assertLinesMatch(expectedOutLines, result.getOutputLines("out")); assertLinesMatch(expectedErrLines, result.getOutputLines("err")); @@ -440,6 +441,13 @@ void executeOnJava8SelectPackage() throws IOException { + " (group ID: org.junit.vintage, artifact ID: junit-vintage-engine, version: " + vintageVersion)); } + private static List getExpectedErrLinesOnJava8(Path workspace) throws IOException { + var expectedErrLines = new ArrayList(); + expectedErrLines.add(">> JAVA VERSION >>"); + expectedErrLines.addAll(Files.readAllLines(workspace.resolve("expected-err.txt"))); + return expectedErrLines; + } + @Test @Order(6) @Disabled("https://github.com/junit-team/junit5/issues/1724")