From 37d1db7f3b541f47637c43fce5e37a9afa311035 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Tue, 19 Nov 2024 16:26:22 +0100 Subject: [PATCH] re-include class names in reported tests This amends changes from #87, by removing the redundant ".skip(1)", and also reverts the changes done to the corresponding unit test. --- .../junit/jupiter/internal/Configuration.java | 10 +++------- ...FlatPrintingTestListenerFormatterTest.java | 20 +++++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/library/src/main/java/com/github/sbt/junit/jupiter/internal/Configuration.java b/src/library/src/main/java/com/github/sbt/junit/jupiter/internal/Configuration.java index 5d5a352..fd848fa 100644 --- a/src/library/src/main/java/com/github/sbt/junit/jupiter/internal/Configuration.java +++ b/src/library/src/main/java/com/github/sbt/junit/jupiter/internal/Configuration.java @@ -317,11 +317,7 @@ public String format() { .reduce((first, last) -> last) .orElse(null); - return path.stream() - .skip(1) - .map(this::toName) - .filter(Objects::nonNull) - .collect(Collectors.joining()); + return path.stream().map(this::toName).filter(Objects::nonNull).collect(Collectors.joining()); } private List getPath(TestPlan testPlan, TestIdentifier identifier) { @@ -390,7 +386,7 @@ private String toName(TestIdentifier identifier, Segment segment) { name = colorTheme.container().format(":" + segment.getValue()); break; default: - name = segment.getValue(); + name = null; break; } @@ -436,7 +432,7 @@ private String toVintageName(TestIdentifier identifier, Segment lastSegment) { } } - return "/" + identifier.getDisplayName(); + return null; } /* diff --git a/src/library/src/test/java/com/github/sbt/junit/jupiter/internal/listeners/FlatPrintingTestListenerFormatterTest.java b/src/library/src/test/java/com/github/sbt/junit/jupiter/internal/listeners/FlatPrintingTestListenerFormatterTest.java index d642c4b..08e0186 100644 --- a/src/library/src/test/java/com/github/sbt/junit/jupiter/internal/listeners/FlatPrintingTestListenerFormatterTest.java +++ b/src/library/src/test/java/com/github/sbt/junit/jupiter/internal/listeners/FlatPrintingTestListenerFormatterTest.java @@ -29,18 +29,22 @@ public static Object[][] samples() { // @formatter:off return new Object[][] { - {"jupiter.samples.NestedTests", "testOfFirstNestedClass", "$First#{1}()"}, - {"jupiter.samples.RepeatedTests", "repeatedTest", "#{1}():#1"}, + {"jupiter.samples.NestedTests", "testOfFirstNestedClass", "{0}$First#{1}()"}, + {"jupiter.samples.RepeatedTests", "repeatedTest", "{0}#{1}():#1"}, { "jupiter.samples.RepeatedTests", "repeatedTestWithRepetitionInfo", - "#{1}(org.junit.jupiter.api.RepetitionInfo):#1" + "{0}#{1}(org.junit.jupiter.api.RepetitionInfo):#1" }, - {"jupiter.samples.SimpleTests", "firstTestMethod", "#{1}()"}, - {"jupiter.samples.SimpleTests", "testWithParameter", "#{1}(org.junit.jupiter.api.TestInfo)"}, - {"jupiter.samples.VintageTests", "vintageTestMethod", "#{1}"}, - {"jupiter.samples.VintageEnclosedTests", "testMethod", "$NestedTest#{1}"}, - {"jupiter.samples.VintageParameterizedTests", "testParameters", "#{1}[A-65]"}, + {"jupiter.samples.SimpleTests", "firstTestMethod", "{0}#{1}()"}, + { + "jupiter.samples.SimpleTests", + "testWithParameter", + "{0}#{1}(org.junit.jupiter.api.TestInfo)" + }, + {"jupiter.samples.VintageTests", "vintageTestMethod", "{0}#{1}"}, + {"jupiter.samples.VintageEnclosedTests", "testMethod", "{0}$NestedTest#{1}"}, + {"jupiter.samples.VintageParameterizedTests", "testParameters", "{0}#{1}[A-65]"}, {"jupiter.samples.SuiteTest", "firstTestMethod", "jupiter.samples.SimpleTests#{1}()"}, {"jupiter.samples.SuiteTest", "vintageTestMethod", "jupiter.samples.VintageTests#{1}"} };