surefire:surefire:1.5-SNAPSHOT test failure in XMLReporterTest for non US locale
--------------------------------------------------------------------------------

         Key: SUREFIRE-22
         URL: http://jira.codehaus.org/browse/SUREFIRE-22
     Project: surefire
        Type: Bug

    Versions: 1.5    
 Environment: Windowx XP with Dutch locale, sun jdk 142 and maven 202 snapshot 
m2-20051212.040000.tar.gz
    Reporter: Marcel Schutte
 Assigned to: Jason van Zyl 
 Attachments: XMLReporter.patch, XMLReporterTest.patch

This report is about building maven itself from the latest sources.

The testElapsedTimeAsString() method in XMLReporterTest currently enforces that 
the call reporter.elapsedTimeAsString( 1000 ) returns "1.00" and not "1,00".

However, for my locale (which is Dutch) the returned value IS "1,00". This 
causes the build of this component to fail with a test failure.

The method elapsedTimeAsString( ) tries to force a decimal point to be used by 
using new DecimalFormat( "##0.00" ). This doesn't work because java will still 
substitute the decimal separator as defined by the current locale. This could 
be fixed by using applyLocalizedPattern(), but my tests have shown that this is 
not necessary.

Because of the fix for MOJO-100, the surefire-report plugin correctly handles 
numbers formatted for the current locale. In my opinion the correct way to go 
is:
- remove 'protected String elapsedTimeAsString( long runTime )' from 
XMLReporter, it overrides a method in AbstractReporter which works fine.
- remove 'public void testElapsedTimeAsString()' from XMLReporterTest, its only 
use is to enforce the decimal point in a formatted time
See the attached patches for these changes.

This can be tested by switching you box to Dutch locale (windows: control 
panel/regional and language options) and running mvn surefire-report:report on 
surefire:surefire:1.5-SNAPSHOT. The surefire-reports/*.xml files should contain 
timing information with comma's in their time info, but surefire-report.html 
should contain the times with decimal points.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to