Updated Branches:
  refs/heads/camel-2.12.x 191df3dde -> f6f28b502

CAMEL-6754 Fixed the UnitUtilsTest error in no-english locale with thanks to 
Alessandro


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6e319efa
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6e319efa
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6e319efa

Branch: refs/heads/camel-2.12.x
Commit: 6e319efaaa191637e32ed1c907797859199f87fa
Parents: 191df3d
Author: Willem Jiang <ningji...@apache.org>
Authored: Mon Sep 16 11:00:30 2013 +0800
Committer: Willem Jiang <ningji...@apache.org>
Committed: Mon Sep 16 11:44:44 2013 +0800

----------------------------------------------------------------------
 .../java/org/apache/camel/util/UnitUtilsTest.java | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6e319efa/camel-core/src/test/java/org/apache/camel/util/UnitUtilsTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/util/UnitUtilsTest.java 
b/camel-core/src/test/java/org/apache/camel/util/UnitUtilsTest.java
index e73d5cd..6e087b7 100644
--- a/camel-core/src/test/java/org/apache/camel/util/UnitUtilsTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/UnitUtilsTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.util;
 
+import java.text.DecimalFormatSymbols;
+
 import junit.framework.TestCase;
 
 import static org.apache.camel.util.UnitUtils.printUnitFromBytes;
@@ -23,14 +25,18 @@ import static 
org.apache.camel.util.UnitUtils.printUnitFromBytes;
 public class UnitUtilsTest extends TestCase {
 
     public void testPrintUnitFromBytes() throws Exception {
+
+        // needed for the locales that have a decimal separator other than 
comma
+        char decimalSeparator = 
DecimalFormatSymbols.getInstance().getDecimalSeparator();
+
         assertEquals("999 B", printUnitFromBytes(999));
-        assertEquals("1.0 kB", printUnitFromBytes(1000));
-        assertEquals("1.0 kB", printUnitFromBytes(1001));
+        assertEquals("1" + decimalSeparator + "0 kB", 
printUnitFromBytes(1000));
+        assertEquals("1" + decimalSeparator + "0 kB", 
printUnitFromBytes(1001));
 
-        assertEquals("1000.0 kB", printUnitFromBytes(999999));
-        assertEquals("1.0 MB", printUnitFromBytes(1000000));
-        assertEquals("1.0 MB", printUnitFromBytes(1000001));
+        assertEquals("1000" + decimalSeparator + "0 kB", 
printUnitFromBytes(999999));
+        assertEquals("1" + decimalSeparator + "0 MB", 
printUnitFromBytes(1000000));
+        assertEquals("1" + decimalSeparator + "0 MB", 
printUnitFromBytes(1000001));
 
-        assertEquals("1.5 MB", printUnitFromBytes(1500001));
+        assertEquals("1" + decimalSeparator + "5 MB", 
printUnitFromBytes(1500001));
     }
 }

Reply via email to