Tibor17 commented on a change in pull request #457:
URL: https://github.com/apache/maven-surefire/pull/457#discussion_r799571827



##########
File path: 
surefire-api/src/main/java/org/apache/maven/surefire/api/report/LegacyPojoStackTraceWriter.java
##########
@@ -81,19 +80,26 @@ public String smartTrimmedStackTrace()
         result.append( "#" );
         result.append( testMethod );
         SafeThrowable throwable = getThrowable();
-        if ( throwable.getTarget() instanceof AssertionError )
-        {
-            result.append( " " );
-            result.append( getTruncatedMessage( throwable.getMessage(), 
MAX_LINE_LENGTH - result.length() ) );
-        }
-        else
+        Throwable target = throwable.getTarget();
+
+        if ( target != null )
         {
-            Throwable target = throwable.getTarget();
-            if ( target != null )
+
+            final String excClassName = target.getClass().getName();
+
+            if ( ! ( AssertionError.class.isInstance( target )
+                    || excClassName.endsWith( ".AssertionFailedError" )
+                    || excClassName.endsWith( ".ComparisonFailure" )
+                    || excClassName.startsWith( "org.opentest4j." ) ) )
+            {
+                result.append( ' ' )
+                      .append( target.getClass().getSimpleName() );
+            }
+            final String msg = throwable.getMessage();
+            if ( isNotEmpty( msg ) )
             {
-                result.append( " " );
-                result.append( target.getClass().getSimpleName() );
-                result.append( getTruncatedMessage( throwable.getMessage(), 
MAX_LINE_LENGTH - result.length() ) );
+                result.append( ' ' )
+                      .append( msg.split( "\r?\n" )[0] );

Review comment:
       I know that the `.split( "\r?\n" )[0]` was my request but this part of 
code will break the nackwards compatibility. Pls use only `.append( msg );`, thx
   And I wahe additionalt question. Is the code between the lines 90 and 103 
the same in the class `SmartStackTraceParser` - see the lines 133 - 146? Is it 
possible to share this code between classes?
   Has the method `toMinimalThrowableMiniMessage()` the same code in both 
classes?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to