maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject [1/2] git commit: o Fixed bug reported by olamy where tests in superclasses were nameless
Date Thu, 20 Dec 2012 03:05:18 GMT
Updated Branches:
  refs/heads/master efd554f78 -> e7a18cb2c


o Fixed bug reported by olamy where tests in superclasses were nameless


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/e7a18cb2
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/e7a18cb2
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/e7a18cb2

Branch: refs/heads/master
Commit: e7a18cb2c5ff7031da26d4387e87583bcc765462
Parents: 3fb7247
Author: Kristian Rosenvold <krosenvold@apache.org>
Authored: Thu Dec 20 04:04:45 2012 +0100
Committer: Kristian Rosenvold <krosenvold@apache.org>
Committed: Thu Dec 20 04:04:45 2012 +0100

----------------------------------------------------------------------
 .../surefire/report/SmartStackTraceParser.java     |   35 ++++++++++-----
 .../surefire/report/SmartStackTraceParserTest.java |    3 +-
 2 files changed, 25 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e7a18cb2/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
----------------------------------------------------------------------
diff --git a/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
b/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
index 4f46ac7..74b5c71 100644
--- a/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
+++ b/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
@@ -22,7 +22,6 @@ package org.apache.maven.surefire.report;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import org.apache.maven.shared.utils.StringUtils;
 
 /**
  * @author Kristian Rosenvold
@@ -69,22 +68,34 @@ public class SmartStackTraceParser
     }
 
 
-    private static String getSimpleName(String className){
+    private static String getSimpleName( String className )
+    {
         int i = className.lastIndexOf( "." );
-        return className.substring(  i + 1 );
+        return className.substring( i + 1 );
     }
+
     @SuppressWarnings( "ThrowableResultOfMethodCallIgnored" )
     public String getString()
     {
         StringBuilder result = new StringBuilder();
-        result.append( simpleName );
-        result.append( "#" );
         List<StackTraceElement> stackTraceElements = focusOnClass( stackTrace, testClass
);
         Collections.reverse( stackTraceElements );
-        for ( StackTraceElement stackTraceElement : stackTraceElements )
+        StackTraceElement stackTraceElement;
+        for ( int i = 0; i < stackTraceElements.size(); i++ )
         {
-            if (!stackTraceElement.getClassName().equals(  testClassName )){
-                result.append( "<" ).append( getSimpleName( stackTraceElement.getClassName()
)); // Add the name of the superclas
+            stackTraceElement = stackTraceElements.get( i );
+            if ( i == 0 )
+            {
+                result.append( simpleName );
+                result.append( "#" );
+            }
+            if ( !stackTraceElement.getClassName().equals( testClassName ) )
+            {
+                if ( i > 0 )
+                {
+                    result.append( "<" );
+                }
+                result.append( getSimpleName( stackTraceElement.getClassName() ) ); // Add
the name of the superclas
                 result.append( "#" );
             }
             result.append( stackTraceElement.getMethodName() ).append( "(" ).append(
@@ -140,10 +151,12 @@ public class SmartStackTraceParser
         List<StackTraceElement> result = new ArrayList<StackTraceElement>();
         for ( StackTraceElement element : stackTrace )
         {
-            if ( isInSupers( clazz, element.getClassName() ) ) {
-            result.add( element );
+            if ( isInSupers( clazz, element.getClassName() ) )
+            {
+                result.add( element );
+            }
         }
-        } return result;
+        return result;
     }
 
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e7a18cb2/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java
----------------------------------------------------------------------
diff --git a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java
b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java
index cb4f658..9affc79 100644
--- a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java
+++ b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java
@@ -127,8 +127,7 @@ public class SmartStackTraceParserTest
         {
             SmartStackTraceParser smartStackTraceParser = new SmartStackTraceParser( ASubClass.class,
e );
             String res = smartStackTraceParser.getString();
-            Assert.assertTrue(
-                "ASubClass#<ABaseClass#npe(27) >> NullPointerException It was null".equals(
res ) );
+            Assert.assertTrue( "ASubClass#ABaseClass#npe(27) >> NullPointerException
It was null".equals( res ) );
 
         }
     }


Mime
View raw message