]> granicus.if.org Git - icu/commitdiff
ICU-13830 Fixing CurrencyDisplayNames boolean attribute behavior. (#141)
authorShane <sffc@sffc1.com>
Thu, 20 Sep 2018 21:46:32 +0000 (14:46 -0700)
committerShane Carr <shane@unicode.org>
Thu, 27 Sep 2018 21:27:41 +0000 (14:27 -0700)
icu4j/main/classes/core/src/com/ibm/icu/text/CurrencyDisplayNames.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/CurrencyTest.java

index 7bf1d0f22a9e2f7bf610fa6b02b5ed37ec9d3013..bbb3cc3d5d6285f28d0f961953de7626d3191be9 100644 (file)
@@ -51,7 +51,7 @@ public abstract class CurrencyDisplayNames {
      * @stable ICU 54
      */
     public static CurrencyDisplayNames getInstance(Locale locale) {
-        return getInstance(locale, true);
+        return getInstance(locale, false);
     }
 
     /**
index 911306db9f5a6f0081e6869d97e55e760de53b59..508e8faa5e5460acba88893b859ac19d115e88d7 100644 (file)
@@ -320,6 +320,18 @@ public class CurrencyTest extends TestFmwk {
         assertNotNull("have currency data for Germany (Java Locale)", cdn);
         assertEquals("de_USD_name (Locale)", "US-Dollar", cdn.getName("USD"));
         assertNull("de_FOO_name (Locale)", cdn.getName("FOO"));
+
+        // Locale version with noSubstitute=false
+        cdn = CurrencyDisplayNames.getInstance(Locale.GERMANY, false);
+        assertNotNull("have currency data for Germany (Java Locale, false)", cdn);
+        assertEquals("de_USD_name (Locale, false)", "US-Dollar", cdn.getName("USD"));
+        assertEquals("de_USD_plural_foo (Locale, false)", "US-Dollar", cdn.getPluralName("USD", "foo"));
+
+        // Locale version with no boolean attribute; should behave the same as noSubstitute=false
+        cdn = CurrencyDisplayNames.getInstance(Locale.GERMANY);
+        assertNotNull("have currency data for Germany (Java Locale, default)", cdn);
+        assertEquals("de_USD_name (Locale, default)", "US-Dollar", cdn.getName("USD"));
+        assertEquals("de_USD_plural_foo (Locale, default)", "US-Dollar", cdn.getPluralName("USD", "foo"));
     }
 
     // Coverage-only test of CurrencyData