eolivelli commented on a change in pull request #211: Added more unit tests in 
SmartStackTraceParserTest and refactoring of SmartStackTraceParser
URL: https://github.com/apache/maven-surefire/pull/211#discussion_r241958312
 
 

 ##########
 File path: 
surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
 ##########
 @@ -103,64 +97,62 @@ public String getString()
         }
         else
         {
-            for ( int i = 0; i < stackTraceElements.size(); i++ )
+            for ( int i = 0, size = stackTraceElements.size(); i < size; i++ )
             {
                 final StackTraceElement stackTraceElement = 
stackTraceElements.get( i );
+                final boolean isTestClassName = 
stackTraceElement.getClassName().equals( testClassName );
                 if ( i == 0 )
                 {
-                    result.append( simpleName );
-                    if ( !stackTraceElement.getClassName().equals( 
testClassName ) )
-                    {
-                        result.append( ">" );
-                    }
-                    else
-                    {
-                        result.append( "." );
-                    }
+                    result.append( testClassSimpleName )
+                            .append( isTestClassName ? '.' : '>' );
                 }
-                if ( !stackTraceElement.getClassName().equals( testClassName ) 
)
+
+                if ( !isTestClassName )
                 {
-                    result.append( getSimpleName( 
stackTraceElement.getClassName() ) ) // Add the name of the superclas
-                        .append( "." );
+                    result.append( toSimpleClassName( 
stackTraceElement.getClassName() ) )
+                        .append( '.' );
                 }
+
                 result.append( stackTraceElement.getMethodName() )
-                    .append( ":" )
+                    .append( ':' )
                     .append( stackTraceElement.getLineNumber() )
                     .append( "->" );
             }
 
             if ( result.length() >= 2 )
             {
-                result.deleteCharAt( result.length() - 1 )
-                    .deleteCharAt( result.length() - 1 );
+                result.setLength( result.length() - 2 );
             }
         }
 
-        Throwable target = throwable.getTarget();
-        String exception = target.getClass().getName();
+        final Throwable target = throwable.getTarget();
+        final Class<?> excType = target.getClass();
+        final String excClassName = excType.getName();
+        final String msg = throwable.getMessage();
+
         if ( target instanceof AssertionError
-            || "junit.framework.AssertionFailedError".equals( exception )
-            || "junit.framework.ComparisonFailure".equals( exception ) )
+                || "junit.framework.AssertionFailedError".equals( excClassName 
)
 
 Review comment:
   Sure.
   My comment was off topic.
   This change is not about those lines.
   I apologize I did not state it clearly.
   This patch is good to go for me

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to