Skip to content

Commit

Permalink
Use same expected files for all JDK versions
Browse files Browse the repository at this point in the history
(cherry picked from commit e802db4)
  • Loading branch information
marcphilipp committed Nov 2, 2023
1 parent 808493a commit c556735
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 43 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));

Expand Down Expand Up @@ -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"));

Expand All @@ -440,6 +441,13 @@ void executeOnJava8SelectPackage() throws IOException {
+ " (group ID: org.junit.vintage, artifact ID: junit-vintage-engine, version: " + vintageVersion));
}

private static List<String> getExpectedErrLinesOnJava8(Path workspace) throws IOException {
var expectedErrLines = new ArrayList<String>();
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")
Expand Down

0 comments on commit c556735

Please sign in to comment.