public void testSetCurrencyLocale_String() {
LOG.info("setCurrencyLocale");
String locale = "ko-KR";
String language = "ko";
String country = "KR";
NumberCurrencySymbolElement cSymbol;
NodeList list;
// first, test setting with a combined language/country
OdfNumberCurrencyStyle instance = new OdfNumberCurrencyStyle(dom,
"\u20a9", "\u20a9#,##0.00", "kstyle");
instance.setCurrencyLocale(locale);
list = instance.getElementsByTagNameNS(
OdfDocumentNamespace.NUMBER.getUri(), "currency-symbol");
Assert.assertTrue("Has currency symbol", list.getLength() > 0);
cSymbol = (NumberCurrencySymbolElement) list.item(0);
Assert.assertEquals(language, cSymbol.getNumberLanguageAttribute());
Assert.assertEquals(country, cSymbol.getNumberCountryAttribute());
// then, a language only
instance = new OdfNumberCurrencyStyle(dom,
"\u20a9", "\u20a9#,##0.00", "kstyle");
instance.setCurrencyLocale(language);
list = instance.getElementsByTagNameNS(
OdfDocumentNamespace.NUMBER.getUri(), "currency-symbol");
Assert.assertTrue("Has currency symbol", list.getLength() > 0);
cSymbol = (NumberCurrencySymbolElement) list.item(0);
Assert.assertEquals(language, cSymbol.getNumberLanguageAttribute());
}