Permalink
Browse files

Force the JUnitReporter to always use points regardless of the locale.

  • Loading branch information...
1 parent 7c335ab commit fe181fcce90929803be3d5a833fc4e6703f5180c @cbeust committed Mar 23, 2012
Showing with 6 additions and 2 deletions.
  1. +1 −0 CHANGES.txt
  2. +5 −2 src/main/java/org/testng/reporters/JUnitReportReporter.java
View
@@ -6,6 +6,7 @@ Added: Reporter display the results in the same order as test methods (Libor Zou
Added: Support for running JUnit 4 tests (Lukas Jungmann)
Added: Ability to auto-detect JUnit tests ('-mixed' mode) (Lukas Jungmann)
Added: Support for ResourceCollections in an Ant tasks (requires Ant >= 1.7.0) (Lukas Jungmann)
+Fixed: GITHUB-198: JUnitReportsReporter use commas in certain locales, which JUnitReports doesn't like
Fixed: GITHUB-173: Dependent methods executed out-of-order if method names match across classes (jjedMoriAnktah)
Fixed: ThreadLocal<ITestResult> leak (aslakknutsen)
Fixed: In the HTML reports, only show the first 100 characters of the parameters
@@ -19,9 +19,9 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
import java.util.Calendar;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -215,7 +215,10 @@ protected String getTestName(ITestResult tr) {
}
private String formatTime(float time) {
- DecimalFormat format = new DecimalFormat("#.###");
+ DecimalFormatSymbols symbols = new DecimalFormatSymbols();
+ // JUnitReports wants points here, regardless of the locale
+ symbols.setDecimalSeparator('.');
+ DecimalFormat format = new DecimalFormat("#.###", symbols);
format.setMinimumFractionDigits(3);
return format.format(time / 1000.0f);
}

0 comments on commit fe181fc

Please sign in to comment.