You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2025/03/17 03:14:18 UTC

(maven-surefire) branch SUREFIRE-1643-junit5-parallel updated: restore backward compat

This is an automated email from the ASF dual-hosted git repository.

olamy pushed a commit to branch SUREFIRE-1643-junit5-parallel
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


The following commit(s) were added to refs/heads/SUREFIRE-1643-junit5-parallel by this push:
     new 8e423737c restore backward compat
8e423737c is described below

commit 8e423737c04bc6e413e5237f08779cd3cd1fc965
Author: Olivier Lamy <ol...@apache.org>
AuthorDate: Mon Mar 17 13:14:04 2025 +1000

    restore backward compat
    
    Signed-off-by: Olivier Lamy <ol...@apache.org>
---
 .../maven/plugin/surefire/report/TestSetRunListener.java      | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
index a47dacb5c..e68d3ff52 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
@@ -50,8 +50,13 @@
 public class TestSetRunListener implements TestReportListener<TestOutputReportEntry> {
     private final Queue<TestMethodStats> testMethodStats = new ConcurrentLinkedQueue<>();
 
+    /**
+     * will be used only if report entru have a sourceName other than that #currentTestSetStats will be usre
+     */
     private final ConcurrentMap<String, TestSetStats> detailsPerSource = new ConcurrentHashMap<>();
 
+    private final TestSetStats currentTestSetStats;
+
     private final ConsoleOutputReportEventListener testOutputReceiver;
 
     private final boolean briefOrPlainFormat;
@@ -93,6 +98,7 @@ public TestSetRunListener(
         this.briefOrPlainFormat = briefOrPlainFormat;
         this.trimStackTrace = trimStackTrace;
         this.isPlainFormat = isPlainFormat;
+        this.currentTestSetStats = new TestSetStats(trimStackTrace, isPlainFormat);
         this.lock = lock;
     }
 
@@ -172,7 +178,10 @@ public void writeTestOutput(TestOutputReportEntry reportEntry) {
     }
 
     private TestSetStats getTestSetStats(ReportEntry report) {
-        String sourceName = report.getSourceName() == null ? report.getName() : report.getSourceName();
+        String sourceName = report.getSourceName();
+        if (sourceName == null) {
+            return currentTestSetStats;
+        }
         return detailsPerSource.computeIfAbsent(sourceName, s -> new TestSetStats(trimStackTrace, isPlainFormat));
     }