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

sor pushed a commit to branch SUREFIRE-1546-ReportEntry-DisplayName
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit ae57472dac328d62de721c671d29e96fb8db65be
Author: Christian Stein <sormu...@gmail.com>
AuthorDate: Fri Sep 14 09:52:02 2018 +0200

    [WIP] Add 'display name' property to ReportEntry
    
    It's value defaults to 'name''s value.
    
    Issue: SUREFIRE-1546
---
 .../plugin/surefire/report/WrappedReportEntry.java   |  6 ++++++
 .../booterclient/ForkingRunListenerTest.java         |  1 +
 .../apache/maven/surefire/report/ReportEntry.java    |  7 +++++++
 .../maven/surefire/report/SimpleReportEntry.java     | 20 ++++++++++++++++++--
 4 files changed, 32 insertions(+), 2 deletions(-)

diff --git 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
index 3426e3a..a2af9a2 100644
--- 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
+++ 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
@@ -101,6 +101,12 @@ public class WrappedReportEntry
         return original.getName();
     }
 
+    @Override
+    public String getDisplayName()
+    {
+        return original.getDisplayName();
+    }
+
     public String getClassMethodName()
     {
         return getSourceName() + "." + getName();
diff --git 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java
 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java
index 0fd275f..16410ab 100644
--- 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java
+++ 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java
@@ -378,6 +378,7 @@ public class ForkingRunListenerTest
             final ReportEntry firstData = getFirstData();
             assertEquals( expected.getSourceName(), firstData.getSourceName() 
);
             assertEquals( expected.getName(), firstData.getName() );
+            assertEquals( expected.getDisplayName(), 
firstData.getDisplayName() );
             //noinspection deprecation
             assertEquals( expected.getElapsed(), firstData.getElapsed() );
             assertEquals( expected.getGroup(), firstData.getGroup() );
diff --git 
a/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java 
b/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java
index ec0f782..05ab4e1 100644
--- 
a/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java
+++ 
b/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java
@@ -40,6 +40,13 @@ public interface ReportEntry
     String getName();
 
     /**
+     * The display name of the test case
+     *
+     * @return An arbitrary string used for display
+     */
+    String getDisplayName();
+
+    /**
      * The group/category of the testcase
      *
      * @return A string
diff --git 
a/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java
 
b/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java
index 1013f39..612d8b5 100644
--- 
a/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java
+++ 
b/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java
@@ -36,6 +36,8 @@ public class SimpleReportEntry
 
     private final String name;
 
+    private final String displayName;
+
     private final StackTraceWriter stackTraceWriter;
 
     private final Integer elapsed;
@@ -69,12 +71,18 @@ public class SimpleReportEntry
 
     public SimpleReportEntry( String source, String name, String message )
     {
-        this( source, name, null, null, message, Collections.<String, 
String>emptyMap() );
+        this( source, name, null, null, message, Collections.<String, 
String>emptyMap(), name );
     }
 
     protected SimpleReportEntry( String source, String name, StackTraceWriter 
stackTraceWriter, Integer elapsed,
                                  String message, Map<String, String> 
systemProperties )
     {
+        this( source, name, null, null, message, Collections.<String, 
String>emptyMap(), name );
+    }
+
+    protected SimpleReportEntry( String source, String name, StackTraceWriter 
stackTraceWriter, Integer elapsed,
+                                 String message, Map<String, String> 
systemProperties, String displayName )
+    {
         if ( source == null )
         {
             source = "null";
@@ -88,6 +96,8 @@ public class SimpleReportEntry
 
         this.name = name;
 
+        this.displayName = displayName;
+
         this.stackTraceWriter = stackTraceWriter;
 
         this.message = message;
@@ -105,7 +115,7 @@ public class SimpleReportEntry
     public SimpleReportEntry( String source, String name, StackTraceWriter 
stackTraceWriter, Integer elapsed,
                               Map<String, String> systemProperties )
     {
-        this( source, name, stackTraceWriter, elapsed, safeGetMessage( 
stackTraceWriter ), systemProperties );
+        this( source, name, stackTraceWriter, elapsed, safeGetMessage( 
stackTraceWriter ), systemProperties, name );
     }
 
     public static SimpleReportEntry assumption( String source, String name, 
String message )
@@ -149,6 +159,12 @@ public class SimpleReportEntry
     }
 
     @Override
+    public String getDisplayName()
+    {
+        return displayName;
+    }
+
+    @Override
     public String getGroup()
     {
         return null;

Reply via email to