/**
* @tests java.util.Currency#getSymbol(java.util.Locale)
*/
public void test_getSymbolLjava_util_Locale() {
Locale.setDefault(Locale.US);
Currency currE = Currency.getInstance("EUR");
assertEquals("EUR", currE.getSymbol(Locale.JAPAN));
assertEquals("EUR", currE.getSymbol(Locale.JAPANESE));
assertEquals("EUR", currE.getSymbol(new Locale("", "FR")));
assertEquals("\u20ac", currE.getSymbol(Locale.FRANCE));
assertEquals("EUR", currE.getSymbol(Locale.FRENCH));
Currency currJ = Currency.getInstance("JPY");
assertEquals("\uffe5", currJ.getSymbol(Locale.JAPAN));
assertEquals("JPY", currJ.getSymbol(Locale.JAPANESE));
assertEquals("JPY", currJ.getSymbol(Locale.FRANCE));
assertEquals("JPY", currJ.getSymbol(Locale.FRENCH));
Currency currUS = Currency.getInstance("USD");
assertEquals("USD", currUS.getSymbol(Locale.JAPAN));
Locale.setDefault(new Locale("ja", "JP"));
assertEquals("\uffe5", currJ.getSymbol(new Locale("", "JP")));
assertEquals("USD", currUS.getSymbol(new Locale("", "JP")));
Locale.setDefault(Locale.US);
assertEquals("JPY", currJ.getSymbol(new Locale("", "JP")));
assertEquals("$", currUS.getSymbol(new Locale("", "JP")));
assertEquals("USD", currUS.getSymbol(Locale.JAPANESE));
assertEquals("USD", currUS.getSymbol(Locale.FRANCE));
assertEquals("USD", currUS.getSymbol(Locale.FRENCH));
assertEquals("USD", currUS.getSymbol(new Locale("fr", "FR")));
assertEquals("$", currUS.getSymbol(new Locale("", "FR"))); // default
// locale
assertEquals("$", currUS.getSymbol(Locale.US));
assertEquals("USD", currUS.getSymbol(Locale.ENGLISH));
assertEquals("$", currUS.getSymbol(new Locale("en", "US")));
assertEquals("$", currUS.getSymbol(new Locale("", "US")));
Currency currCA = Currency.getInstance("CAD");
assertEquals("CAD", currCA.getSymbol(Locale.JAPAN));
assertEquals("CAD", currCA.getSymbol(Locale.JAPANESE));
assertEquals("CAD", currCA.getSymbol(Locale.FRANCE));
assertEquals("CAD", currCA.getSymbol(Locale.FRENCH));
assertEquals("CAD", currCA.getSymbol(Locale.US));
assertEquals("CAD", currCA.getSymbol(Locale.ENGLISH));
assertEquals("CAD", currCA.getSymbol(new Locale("es", "US")));
assertEquals("CAD", currCA.getSymbol(new Locale("en", "US")));
assertEquals("$", currCA.getSymbol(Locale.CANADA));
assertEquals("$", currCA.getSymbol(Locale.CANADA_FRENCH));
assertEquals("$", currCA.getSymbol(new Locale("en", "CA")));
assertEquals("$", currCA.getSymbol(new Locale("fr", "CA")));
assertEquals("CAD", currCA.getSymbol(new Locale("", "CA")));
// tests what happens with improper locales, i.e. countries without the
// given language
assertEquals("currUS.getSymbol(new Locale(\"ar\", \"US\"))", "USD",
currUS.getSymbol(new Locale("ar", "US")));
assertEquals("currUS.getSymbol(new Locale(\"ar\", \"CA\"))", "USD",
currUS.getSymbol(new Locale("ar", "CA")));
assertEquals("currCA.getSymbol(new Locale(\"ar\", \"US\"))", "CAD",
currCA.getSymbol(new Locale("ar", "US")));
assertEquals("currCA.getSymbol(new Locale(\"ar\", \"CA\"))", "CAD",
currCA.getSymbol(new Locale("ar", "CA")));
assertEquals("currJ.getSymbol(new Locale(\"ja\", \"US\"))", "JPY",
currJ.getSymbol(new Locale("ja", "US")));
assertEquals("currUS.getSymbol(new Locale(\"ja\", \"US\"))", "USD",
currUS.getSymbol(new Locale("ja", "US")));
// cross testing between USD and JPY when locale is JAPANESE JAPAN
// set default locale to Locale_ja_JP
Locale.setDefault(new Locale("ja", "JP"));
Currency currJ2 = Currency.getInstance("JPY");
Currency currUS2 = Currency.getInstance("USD");
// the real JAPAN locale
assertEquals("\uffe5", currJ2.getSymbol(new Locale("ja", "JP")));
// no language
assertEquals("\uffe5", currJ2.getSymbol(new Locale("", "JP")));
// no country
assertEquals("JPY", currJ2.getSymbol(new Locale("ja", "")));
// no language
assertEquals("\uffe5", currJ2.getSymbol(new Locale("", "US")));
// no country
assertEquals("JPY", currJ2.getSymbol(new Locale("en", "")));
// bogus Locales , when default locale is Locale_ja_JP
assertEquals("JPY", currJ2.getSymbol(new Locale("ar", "JP")));
assertEquals("JPY", currJ2.getSymbol(new Locale("ar", "US")));
assertEquals("JPY", currJ2.getSymbol(new Locale("ja", "AE")));
assertEquals("JPY", currJ2.getSymbol(new Locale("en", "AE")));
assertEquals("currJ.getSymbol(new Locale(\"ja\", \"US\"))", "JPY",
currJ.getSymbol(new Locale("ja", "US")));
// the real US locale
assertEquals("$", currUS2.getSymbol(new Locale("en", "US")));
// no country
assertEquals("USD", currUS2.getSymbol(new Locale("ja", "")));
// no language
assertEquals("USD", currUS2.getSymbol(new Locale("", "JP")));
// no language
assertEquals("USD", currUS2.getSymbol(new Locale("", "US")));
// no country
assertEquals("USD", currUS2.getSymbol(new Locale("en", "")));
// bogus Locales , when default locale is Locale_ja_JP
assertEquals("USD", currUS2.getSymbol(new Locale("ar", "JP")));
assertEquals("USD", currUS2.getSymbol(new Locale("ar", "US")));
assertEquals("USD", currUS2.getSymbol(new Locale("ja", "AE")));
assertEquals("USD", currUS2.getSymbol(new Locale("en", "AE")));
assertEquals("currUS.getSymbol(new Locale(\"ja\", \"US\"))", "USD",
currUS.getSymbol(new Locale("ja", "US")));
Locale.setDefault(Locale.US);
// euro tests
Currency currDKK = Currency.getInstance("DKK");
assertEquals("\u20ac", currE.getSymbol(new Locale("da", "DK")));
assertEquals("kr", currDKK.getSymbol(new Locale("da", "DK")));
assertEquals("EUR", currE.getSymbol(new Locale("da", "")));
assertEquals("DKK", currDKK.getSymbol(new Locale("da", "")));
assertEquals("EUR", currE.getSymbol(new Locale("", "DK")));
assertEquals("DKK", currDKK.getSymbol(new Locale("", "DK")));
Locale.setDefault(new Locale("da", "DK"));
assertEquals("\u20ac", currE.getSymbol(new Locale("da", "DK")));
assertEquals("kr", currDKK.getSymbol(new Locale("da", "DK")));
assertEquals("EUR", currE.getSymbol(new Locale("da", "")));
assertEquals("DKK", currDKK.getSymbol(new Locale("da", "")));
assertEquals("\u20ac", currE.getSymbol(new Locale("", "DK")));
assertEquals("kr", currDKK.getSymbol(new Locale("", "DK")));
assertEquals("EUR", currE.getSymbol(new Locale("ar", "AE")));
assertEquals("DKK", currDKK.getSymbol(new Locale("ar", "AE")));
}