maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r348390 - in /maven/surefire/trunk/surefire/src: main/java/org/codehaus/surefire/report/XMLReporter.java test/java/org/codehaus/surefire/report/XMLReporterTest.java
Date Wed, 23 Nov 2005 07:01:03 GMT
Author: carlos
Date: Tue Nov 22 23:01:00 2005
New Revision: 348390

URL: http://svn.apache.org/viewcvs?rev=348390&view=rev
Log:
Added test for elapsedTimeAsString and improved DecimalFormat handling

Modified:
    maven/surefire/trunk/surefire/src/main/java/org/codehaus/surefire/report/XMLReporter.java
    maven/surefire/trunk/surefire/src/test/java/org/codehaus/surefire/report/XMLReporterTest.java

Modified: maven/surefire/trunk/surefire/src/main/java/org/codehaus/surefire/report/XMLReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/trunk/surefire/src/main/java/org/codehaus/surefire/report/XMLReporter.java?rev=348390&r1=348389&r2=348390&view=diff
==============================================================================
--- maven/surefire/trunk/surefire/src/main/java/org/codehaus/surefire/report/XMLReporter.java
(original)
+++ maven/surefire/trunk/surefire/src/main/java/org/codehaus/surefire/report/XMLReporter.java
Tue Nov 22 23:01:00 2005
@@ -39,6 +39,8 @@
 public class XMLReporter 
     extends AbstractReporter
 {
+    private static final DecimalFormat TIME_FORMAT = new DecimalFormat( "##0.00" );
+
     private PrintWriter writer;
     
     private Xpp3Dom testSuite;
@@ -293,8 +295,6 @@
     
     protected String elapsedTimeAsString( long runTime )
     {
-        DecimalFormat DECIMAL_FORMAT = new DecimalFormat( "##0.00" );
-       
-        return DECIMAL_FORMAT.format( (double) runTime / 1000 );
+        return TIME_FORMAT.format( (double) runTime / 1000 );
     }
 }

Modified: maven/surefire/trunk/surefire/src/test/java/org/codehaus/surefire/report/XMLReporterTest.java
URL: http://svn.apache.org/viewcvs/maven/surefire/trunk/surefire/src/test/java/org/codehaus/surefire/report/XMLReporterTest.java?rev=348390&r1=348389&r2=348390&view=diff
==============================================================================
--- maven/surefire/trunk/surefire/src/test/java/org/codehaus/surefire/report/XMLReporterTest.java
(original)
+++ maven/surefire/trunk/surefire/src/test/java/org/codehaus/surefire/report/XMLReporterTest.java
Tue Nov 22 23:01:00 2005
@@ -49,7 +49,7 @@
     public void testTestError()
     {
         reporter.testError( reportEntry, "", "" );
-        assertResult(reporter, message);
+        assertResult( reporter, message );
     }
 
     /*
@@ -58,14 +58,21 @@
     public void testTestFailed()
     {
         reporter.testError( reportEntry, "", "" );
-        assertResult(reporter, message);
+        assertResult( reporter, message );
     }
 
-    private void assertResult(XMLReporter reporter, String message)
+    private void assertResult( XMLReporter reporter, String message )
     {
         Xpp3Dom result = reporter.getTestCase();
         Xpp3Dom child = result.getChild( "error" );
         assertEquals( message, child.getAttribute( "type" ) );
+    }
+
+    public void testElapsedTimeAsString()
+    {
+        String timeAsString = reporter.elapsedTimeAsString( 1000 );
+        assertTrue( timeAsString.indexOf( "." ) >= 0 );
+        assertTrue( timeAsString.indexOf( "," ) < 0 );
     }
 
 }



Mime
View raw message