Skip to content

Commit

Permalink
[SUREFIRE-2168] Use proper en dash approximation for console report o…
Browse files Browse the repository at this point in the history
…utput
  • Loading branch information
michael-o committed May 28, 2023
1 parent 2967be3 commit 40e1d03
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class JUnit5StatelessTestsetInfoReporter extends SurefireStatelessTestset

/**
* Phrased class name of test case in the log (see xxx)
* <em>Tests run: ., Failures: ., Errors: ., Skipped: ., Time elapsed: . s, - in xxx</em>.
* <em>Tests run: ., Failures: ., Errors: ., Skipped: ., Time elapsed: . s, -- in xxx</em>.
* {@code false} by default.
* <br>
* This action takes effect only in JUnit5 provider together with a test class annotated <em>DisplayName</em>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class TestSetStats {
private static final String ERRORS = "Errors: ";
private static final String SKIPPED = "Skipped: ";
private static final String FAILURE_MARKER = " <<< FAILURE!";
private static final String IN_MARKER = " - in ";
private static final String IN_MARKER = " -- in ";
private static final String COMMA = ", ";

private final Queue<WrappedReportEntry> reportEntries = new ConcurrentLinkedQueue<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public String getElapsedTimeVerbose() {

public String getElapsedTimeSummary() {
String description = getName() == null ? getSourceName() : getClassMethodName();
return description + " " + getElapsedTimeVerbose();
return description + " -- " + getElapsedTimeVerbose();
}

public boolean isErrorOrFailure() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public void testDisplayNames() {
assertTrue(wr.isErrorOrFailure());
assertFalse(wr.isSkipped());
assertNull(wr.getStackTraceWriter());
assertEquals("surefire.testcase.JunitParamsTest.testSum Time elapsed: 0.012 s", wr.getElapsedTimeSummary());
assertEquals("surefire.testcase.JunitParamsTest.testSum -- Time elapsed: 0.012 s", wr.getElapsedTimeSummary());
assertEquals(
"surefire.testcase.JunitParamsTest.testSum Time elapsed: 0.012 s <<< ERROR!", wr.getOutput(false));
"surefire.testcase.JunitParamsTest.testSum -- Time elapsed: 0.012 s <<< ERROR!", wr.getOutput(false));
assertEquals("exception", wr.getMessage());
}

Expand Down Expand Up @@ -147,6 +147,6 @@ public void testElapsed() {
ReportEntry reportEntry = new SimpleReportEntry(NORMAL_RUN, 1L, className, null, null, null);
WrappedReportEntry wr = new WrappedReportEntry(reportEntry, null, 12, null, null);
String elapsedTimeSummary = wr.getElapsedTimeSummary();
assertEquals("[0] 1, 2, 3 (testSum) Time elapsed: 0.012 s", elapsedTimeSummary);
assertEquals("[0] 1, 2, 3 (testSum) -- Time elapsed: 0.012 s", elapsedTimeSummary);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void shouldReportTestsetLifecycle() {
.hasSize(2)
.containsSequence(
"Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.03 s "
+ "<<< FAILURE! - in pkg.MyTest",
+ "<<< FAILURE! -- in pkg.MyTest",
"pkg.MyTest failed");
verifyNoMoreInteractions(consoleLogger);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ public void test47() throws Exception {
containsString("Time elapsed: 1."),
containsString("Time elapsed: 1 s"),
containsString("Time elapsed: 0.9")));
assertThat(result, endsWith(" s - in concurrentjunit47.src.test.java.junit47.BasicTest"));
assertThat(result, endsWith(" s -- in concurrentjunit47.src.test.java.junit47.BasicTest"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public void testJupiterEngineWithDisplayNames() throws VerificationException {

validator
.getSurefireReportsFile("junitplatformenginejupiter.DisplayNameTest.txt", UTF_8)
.assertContainsText(" - in << ✨ >>");
.assertContainsText(" -- in << ✨ >>");

validator
.getSurefireReportsFile("junitplatformenginejupiter.DisplayNameTest-output.txt", UTF_8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
* Example, UnlistedTest is the problem here because it runs with filtered out methods:
*
* Running pkg.UnlistedTest
* Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in pkg.UnlistedTest
* Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s -- in pkg.UnlistedTest
* Running pkg.RunningTest
* Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in pkg.RunningTest
* Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s -- in pkg.RunningTest
*
* Results:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ public void testMethodsParallelWithSuite() throws VerificationException {
containsString("Time elapsed: " + delayMax)));
assertThat(
line,
anyOf(endsWith(" s - in surefire747.SuiteTest1"), endsWith(" s - in surefire747.SuiteTest2")));
anyOf(
endsWith(" s -- in surefire747.SuiteTest1"),
endsWith(" s -- in surefire747.SuiteTest2")));
}
}
}
Expand Down

0 comments on commit 40e1d03

Please sign in to comment.