From 087570e74df29f6c951f922e8b44ad19b119230d Mon Sep 17 00:00:00 2001 From: chalkido Date: Thu, 2 Feb 2017 18:06:48 +0000 Subject: [PATCH] toStringWithSuffix decimal mark unit-test issue on non UK/US Locale (#209) Make use of default Locale to temporarily bypass unit-testing of toStringWithSuffix failing due to different decimal marks on non anglo saxon Locales. --- .../corda/explorer/views/GuiUtilitiesKtTest.kt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/explorer/src/test/kotlin/net/corda/explorer/views/GuiUtilitiesKtTest.kt b/tools/explorer/src/test/kotlin/net/corda/explorer/views/GuiUtilitiesKtTest.kt index 7e830bc914..4902fb69df 100644 --- a/tools/explorer/src/test/kotlin/net/corda/explorer/views/GuiUtilitiesKtTest.kt +++ b/tools/explorer/src/test/kotlin/net/corda/explorer/views/GuiUtilitiesKtTest.kt @@ -2,15 +2,20 @@ package net.corda.explorer.views import org.junit.Assert.assertEquals import org.junit.Test +import java.text.DecimalFormatSymbols +import java.util.* class GuiUtilitiesKtTest { @Test fun `test to string with suffix`() { - assertEquals("10.5k", 10500.toStringWithSuffix()) + //Required for this test to be independent of the default Locale. + val ds = DecimalFormatSymbols(Locale.getDefault()).decimalSeparator + + assertEquals("10${ds}5k", 10500.toStringWithSuffix()) assertEquals("100", 100.toStringWithSuffix()) - assertEquals("5.0M", 5000000.toStringWithSuffix()) - assertEquals("1.0B", 1000000000.toStringWithSuffix()) - assertEquals("1.5T", 1500000000000.toStringWithSuffix()) - assertEquals("1000.0T", 1000000000000000.toStringWithSuffix()) + assertEquals("5${ds}0M", 5000000.toStringWithSuffix()) + assertEquals("1${ds}0B", 1000000000.toStringWithSuffix()) + assertEquals("1${ds}5T", 1500000000000.toStringWithSuffix()) + assertEquals("1000${ds}0T", 1000000000000000.toStringWithSuffix()) } } \ No newline at end of file