Updated Branches: refs/heads/master b544ac298 -> 961413cca
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/a370257b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a370257b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a370257b Branch: refs/heads/master Commit: a370257be9b2ffa86ecf461d9bb29aec8ddabc0b Parents: b544ac2 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:00:30 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/a370257b/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)); } }