From 219af6ef9b40a39728f204ca20ebffdaa0a24ff7 Mon Sep 17 00:00:00 2001 From: Neil Fuller Date: Wed, 18 Jun 2014 17:05:32 +0100 Subject: Alter regression test for bug 71369 now the issue is understood The code was most likely fixed by an ICU update. This was added to prevent regression. See the bug for details. Bug: 71369 Change-Id: I8896334dfeac3a1dcb6379ac58510ede60f6b7c7 --- luni/src/test/java/libcore/java/text/DecimalFormatTest.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'luni/src/test') diff --git a/luni/src/test/java/libcore/java/text/DecimalFormatTest.java b/luni/src/test/java/libcore/java/text/DecimalFormatTest.java index 52b6fa2..722924d 100644 --- a/luni/src/test/java/libcore/java/text/DecimalFormatTest.java +++ b/luni/src/test/java/libcore/java/text/DecimalFormatTest.java @@ -261,8 +261,7 @@ public class DecimalFormatTest extends junit.framework.TestCase { } } - // Confirm correct fractional digit handling in NumberFormat.getCurrencyInstance() / - // DecimalFormat. + // Confirm the fraction digits do not change when the currency is changed. public void testBug71369() { final String nonBreakingSpace = "\u00A0"; @@ -273,6 +272,14 @@ public class DecimalFormatTest extends junit.framework.TestCase { numberFormat.setMinimumFractionDigits(0); numberFormat.setMaximumFractionDigits(0); - assertEquals("2" + nonBreakingSpace + "$", numberFormat.format(2.01)); + + String expected = "2" + nonBreakingSpace + "$"; + assertEquals(expected, numberFormat.format(2.01)); + + // Changing the currency must not reset the digits. + numberFormat.setCurrency(Currency.getInstance("EUR")); + numberFormat.setCurrency(Currency.getInstance("USD")); + + assertEquals(expected, numberFormat.format(2.01)); } } -- cgit v1.1