/** ******************************************************************************* * Copyright (C) 2001-2010, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ package com.ibm.icu.dev.test.util; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.JarURLConnection; import java.net.URL; import java.net.URLConnection; import java.nio.ByteBuffer; import java.util.Enumeration; import java.util.MissingResourceException; import java.util.Set; import java.util.TreeSet; import java.util.jar.JarEntry; import com.ibm.icu.dev.test.TestFmwk; import com.ibm.icu.impl.ICUResourceBundle; import com.ibm.icu.impl.Utility; import com.ibm.icu.text.BreakIterator; import com.ibm.icu.text.UTF16; import com.ibm.icu.util.Calendar; import com.ibm.icu.util.Holiday; import com.ibm.icu.util.ULocale; import com.ibm.icu.util.UResourceBundle; import com.ibm.icu.util.UResourceTypeMismatchException; public final class ICUResourceBundleTest extends TestFmwk { private static final ClassLoader testLoader = ICUResourceBundleTest.class.getClassLoader(); public static void main(String args[]) throws Exception { ICUResourceBundleTest test = new ICUResourceBundleTest(); test.run(args); } public void TestGetResources(){ try{ // It does not work well in eclipse plug-in test because of class loader configuration?? // For now, specify resource path explicitly in this test case //Enumeration en = testLoader.getResources("META-INF"); Enumeration en = testLoader.getResources("com.ibm.icu.dev.data"); for(;en.hasMoreElements();) { URL url = (URL)en.nextElement(); if (url == null) { warnln("could not load resource data"); return; } URLConnection c = url.openConnection(); if (c instanceof JarURLConnection) { JarURLConnection jc = (JarURLConnection)c; JarEntry je = jc.getJarEntry(); logln("jar entry: " + je.toString()); } else { InputStream is = c.getInputStream(); logln("input stream:"); InputStreamReader r = new InputStreamReader(is); BufferedReader br = new BufferedReader(r); String line = null; int n = 0; while ((line = br.readLine()) != null) { logln(" " + ++n + ": " + line); } } } }catch(SecurityException ex) { warnln("could not load resource data: " + ex); ex.printStackTrace(); }catch(NullPointerException ex) { // thrown by ibm 1.4.2 windows jvm security manager warnln("could not load resource data: " + ex); }catch(Exception ex){ ex.printStackTrace(); errln("Unexpected exception: "+ ex); } } public void TestResourceBundleWrapper(){ UResourceBundle bundle = UResourceBundle.getBundleInstance("com.ibm.icu.impl.data.HolidayBundle", "da_DK"); Object o = bundle.getObject("holidays"); if(o instanceof Holiday[] ){ logln("wrapper mechanism works for Weekend data"); }else{ errln("Did not get the expected output for Weekend data"); } bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "bogus"); if(bundle instanceof UResourceBundle && bundle.getULocale().equals("en_US")){ logln("wrapper mechanism works for bogus locale"); }else{ errln("wrapper mechanism failed for bogus locale."); } try{ bundle = UResourceBundle.getBundleInstance("bogus", "bogus"); if(bundle!=null){ errln("Did not get the expected exception"); } }catch(MissingResourceException ex){ logln("got the expected exception"); } } public void TestJB3879(){ // this tests tests loading of root bundle when a resource bundle // for the default locale is requested try { UResourceBundle bundle = (UResourceBundle) UResourceBundle.getBundleInstance("com/ibm/icu/dev/data/testdata", ULocale.getDefault().toString(), testLoader); if(bundle==null){ errln("could not create the resource bundle"); } } catch (MissingResourceException ex) { warnln("could not load test data: " + ex.getMessage()); } } public void TestOpen(){ UResourceBundle bundle = (UResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "en_US_POSIX"); if(bundle==null){ errln("could not create the resource bundle"); } UResourceBundle obj = bundle.get("NumberPatterns"); int size = obj.getSize(); int type = obj.getType(); if(type == UResourceBundle.ARRAY){ UResourceBundle sub; for(int i=0; i0){ logln("Alias mechanism works"); }else{ errln("Alias mechanism failed for fr_BE SpelloutRules"); } rb = (UResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_COLLATION_BASE_NAME,"zh_TW"); UResourceBundle b = (UResourceBundle) rb.getObject("collations"); if(b != null){ if(b.get(0).getKey().equals( "default")){ logln("Alias mechanism works"); }else{ errln("Alias mechanism failed for zh_TW collations"); } }else{ errln("Did not get the expected object for collations"); } */ } public void TestAlias(){ logln("Testing %%ALIAS"); UResourceBundle rb = (UResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME,"iw_IL"); UResourceBundle b = rb.get("NumberPatterns"); if(b != null){ if(b.getSize()>0){ logln("%%ALIAS mechanism works"); }else{ errln("%%ALIAS mechanism failed for iw_IL NumberPatterns"); } }else{ errln("%%ALIAS mechanism failed for iw_IL"); } } public void TestXPathAlias(){ UResourceBundle rb = (UResourceBundle) UResourceBundle.getBundleInstance("com/ibm/icu/dev/data/testdata","te_IN",testLoader); UResourceBundle b = rb.get("aliasClient"); String result = b.getString(); String expResult= "correct"; if(!result.equals(expResult)){ errln("Did not get the expected result for XPath style alias"); } try{ UResourceBundle c = rb.get("rootAliasClient"); result = c.getString(); expResult = "correct"; if(!result.equals(expResult)){ errln("Did not get the expected result for XPath style alias for rootAliasClient"); } }catch( MissingResourceException ex){ errln("Could not get rootAliasClient"); } } public void TestCircularAliases(){ // Aliases no longer supported // try{ // UResourceBundle rb = (UResourceBundle)UResourceBundle.getBundleInstance("com/ibm/icu/dev/data/testdata","testaliases",testLoader); // UResourceBundle sub = rb.get("aaa"); // String s1 = sub.getString(); // if(s1!=null){ // errln("Did not get the expected exception"); // } // }catch(IllegalArgumentException ex){ // logln("got expected exception for circular references"); // } // catch (MissingResourceException ex) { // warnln("could not load resource data: " + ex.getMessage()); // } } public void TestGetWithFallback(){ /* UResourceBundle bundle =(UResourceBundle) UResourceBundle.getBundleInstance("com/ibm/icu/dev/data/testdata","te_IN"); String key = bundle.getStringWithFallback("Keys/collation"); if(!key.equals("COLLATION")){ errln("Did not get the expected result from getStringWithFallback method."); } String type = bundle.getStringWithFallback("Types/collation/direct"); if(!type.equals("DIRECT")){ errln("Did not get the expected result form getStringWithFallback method."); } */ ICUResourceBundle bundle = null; bundle = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME,"fr_FR"); ICUResourceBundle b1 = bundle.getWithFallback("calendar"); String defaultCal = b1.getStringWithFallback("default"); if(!defaultCal.equals("gregorian")){ errln("Did not get the expected default calendar string: Expected: gregorian, Got: "+defaultCal); } ICUResourceBundle b2 = b1.getWithFallback(defaultCal); ICUResourceBundle b3 = b2.getWithFallback("monthNames"); String defaultContext = b3.getStringWithFallback("default"); ICUResourceBundle b4 = b3.getWithFallback(defaultContext); String defaultWidth = b4.getStringWithFallback("default"); ICUResourceBundle b5 = b4.getWithFallback(defaultWidth); if(b5.getSize()!=12){ errln("Did not get the expected size for the default monthNames"); } } private static final String CALENDAR_RESNAME = "calendar"; private static final String CALENDAR_KEYWORD = "calendar"; public void TestLocaleDisplayNames() { ULocale[] locales = ULocale.getAvailableLocales(); for (int i = 0; i < locales.length; ++i) { if (!hasLocalizedCountryFor(ULocale.ENGLISH, locales[i])){ errln("Could not get localized country for "+ locales[i]); } if(!hasLocalizedLanguageFor(ULocale.ENGLISH, locales[i])){ errln("Could not get localized language for "+ locales[i]); } if(!hasLocalizedCountryFor(locales[i], locales[i])){ errln("Could not get localized country for "+ locales[i]); hasLocalizedCountryFor(locales[i], locales[i]); } if(!hasLocalizedLanguageFor(locales[i], locales[i])){ errln("Could not get localized language for "+ locales[i]); } logln(locales[i] + "\t" + locales[i].getDisplayName(ULocale.ENGLISH) + "\t" + locales[i].getDisplayName(locales[i])); } } private static boolean hasLocalizedLanguageFor(ULocale locale, ULocale otherLocale) { String lang = otherLocale.getLanguage(); String localizedVersion = otherLocale.getDisplayLanguage(locale); return !lang.equals(localizedVersion); } private static boolean hasLocalizedCountryFor(ULocale locale, ULocale otherLocale) { String country = otherLocale.getCountry(); if (country.equals("")) return true; String localizedVersion = otherLocale.getDisplayCountry(locale); return !country.equals(localizedVersion); } public void TestFunctionalEquivalent(){ String[] calCases = { // avail locale equiv "t", "en_US_POSIX", "en_US@calendar=gregorian", "f", "ja_JP_TOKYO", "ja_JP@calendar=gregorian", "f", "ja_JP_TOKYO@calendar=japanese", "ja@calendar=japanese", "t", "sr@calendar=gregorian", "sr@calendar=gregorian", "t", "en", "en@calendar=gregorian", "t", "th_TH", "th@calendar=buddhist", "t", "th_TH@calendar=gregorian", "th_TH@calendar=gregorian", "f", "th_TH_Bangkok", "th@calendar=buddhist", }; logln("Testing functional equivalents for calendar..."); getFunctionalEquivalentTestCases(ICUResourceBundle.ICU_BASE_NAME, Calendar.class.getClassLoader(), CALENDAR_RESNAME, CALENDAR_KEYWORD, false, calCases); logln("Testing error conditions:"); try { ClassLoader cl = BreakIterator.class.getClassLoader(); ICUResourceBundle.getFunctionalEquivalent(ICUResourceBundle.ICU_BRKITR_BASE_NAME, cl, "calendar", "calendar", new ULocale("ar_EG@calendar=islamic"), new boolean[1], true); errln("Err: expected MissingResourceException"); } catch ( MissingResourceException t ) { logln("expected MissingResourceException caught (PASS): " + t.toString()); } } private void getFunctionalEquivalentTestCases(String path, ClassLoader cl, String resName, String keyword, boolean truncate, String[] testCases) { //String F_STR = "f"; String T_STR = "t"; boolean isAvail[] = new boolean[1]; logln("Testing functional equivalents..."); for(int i = 0; i < testCases.length ;i+=3) { boolean expectAvail = T_STR.equals(testCases[i+0]); ULocale inLocale = new ULocale(testCases[i+1]); ULocale expectLocale = new ULocale(testCases[i+2]); logln(new Integer(i/3).toString() + ": " + new Boolean(expectAvail).toString() + "\t\t" + inLocale.toString() + "\t\t" + expectLocale.toString()); ULocale equivLocale = ICUResourceBundle.getFunctionalEquivalent(path, cl, resName, keyword, inLocale, isAvail, truncate); boolean gotAvail = isAvail[0]; if((gotAvail != expectAvail) || !equivLocale.equals(expectLocale)) { errln(new Integer(i/3).toString() + ": Error, expected Equiv=" + new Boolean(expectAvail).toString() + "\t\t" + inLocale.toString() + "\t\t--> " + expectLocale.toString() + ", but got " + new Boolean(gotAvail).toString() + " " + equivLocale.toString()); } } } public void TestNorwegian(){ try{ UResourceBundle rb = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_REGION_BASE_NAME, "no_NO_NY"); UResourceBundle sub = rb.get("Countries"); String s1 = sub.getString("NO"); if(s1.equals("Noreg")){ logln("got expected output "); }else{ errln("did not get the expected result"); } }catch(IllegalArgumentException ex){ errln("Caught an unexpected expected"); } } public void TestJB4102(){ try { ICUResourceBundle root =(ICUResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "root"); ICUResourceBundle t = null; // AmPmMarkers now exist in root/islamic calendar, so this test is rendered useless. // try{ // t = root.getWithFallback("calendar/islamic-civil/AmPmMarkers"); // errln("Second resource does not exist. How did it get here?\n"); // }catch(MissingResourceException ex){ // logln("Got the expected exception"); // } try{ t = root.getWithFallback("calendar/islamic-civil/eras/abbreviated/0/mikimaus/pera"); errln("Second resource does not exist. How did it get here?\n"); }catch(MissingResourceException ex){ logln("Got the expected exception"); } if(t!=null){ errln("t is not null!"); } } catch (MissingResourceException e) { warnln("Could not load the locale data: " + e.getMessage()); } } public void TestCLDRStyleAliases() { String result = null; String expected = null; String[]expects = new String[] { "", "a41", "a12", "a03", "ar4" }; logln("Testing CLDR style aliases......\n"); UResourceBundle rb = UResourceBundle.getBundleInstance("com/ibm/icu/dev/data/testdata", "te_IN_REVISED",testLoader); ICUResourceBundle alias = (ICUResourceBundle)rb.get("a"); for(int i = 1; i < 5 ; i++) { String resource="a"+i; UResourceBundle a = (alias).getWithFallback(resource); result = a.getString(); if(result.equals(expected)) { errln("CLDR style aliases failed resource with name "+resource+"resource, exp "+expects[i] +" , got " + result); } } } private String getLSString(int status){ switch(status){ case ICUResourceBundle.FROM_FALLBACK: return "FROM_FALLBACK"; case ICUResourceBundle.FROM_DEFAULT: return "FROM_DEFAULT"; case ICUResourceBundle.FROM_ROOT: return "FROM_ROOT"; case ICUResourceBundle.FROM_LOCALE: return "FROM_LOCALE"; default: return "UNKNOWN"; } } private void assertEqualLoadingStatus(String msg, int target, int result) { if (result != target) { errln(msg + " expected: "+ getLSString(target) + " got: " + getLSString(result)); } } private void assertDefaultLoadingStatus(String msg, int result) { assertEqualLoadingStatus(msg, ICUResourceBundle.FROM_DEFAULT, result); } private void assertFallbackLoadingStatus(String msg, int result) { assertEqualLoadingStatus(msg, ICUResourceBundle.FROM_FALLBACK, result); } private void assertRootLoadingStatus(String msg, int result) { assertEqualLoadingStatus(msg, ICUResourceBundle.FROM_ROOT, result); } private void assertLocaleLoadingStatus(String msg, int result) { assertEqualLoadingStatus(msg, ICUResourceBundle.FROM_LOCALE, result); } public void TestLoadingStatus(){ ICUResourceBundle bundle = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "yi_IL"); assertDefaultLoadingStatus("base/yi_IL", bundle.getLoadingStatus()); bundle = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "eo_DE"); assertFallbackLoadingStatus("base/eo_DE", bundle.getLoadingStatus()); logln("Test to verify loading status of get(String)"); bundle = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_LANG_BASE_NAME, "zh_Hant_TW"); ICUResourceBundle countries = (ICUResourceBundle) bundle.get("Languages"); assertFallbackLoadingStatus("lang/Languages/zh_Hant_TW", countries.getLoadingStatus()); /* UResourceBundle auxExemplar = bundle.get("AuxExemplarCharacters"); status = auxExemplar.getLoadingStatus(); if(status != UResourceBundle.FROM_ROOT){ errln("Did not get the expected value for loading status. Expected "+ getLSString(UResourceBundle.FROM_ROOT) + " Got: " + getLSString(status)); } */ logln("Test to verify loading status of get(int)"); bundle = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "te_IN"); ICUResourceBundle ms = (ICUResourceBundle) bundle.get("MeasurementSystem"); assertRootLoadingStatus("base/MeasurementSystem/te_IN", ms.getLoadingStatus()); logln("Test to verify loading status of getwithFallback"); bundle = (ICUResourceBundle) UResourceBundle.getBundleInstance("com/ibm/icu/dev/data/testdata", "sh_YU", testLoader); ICUResourceBundle temp = (ICUResourceBundle) bundle.getWithFallback("a/a2"); assertLocaleLoadingStatus("testdata/a/a2/sh_YU", temp.getLoadingStatus()); temp = bundle.getWithFallback("a/a1"); assertFallbackLoadingStatus("testdata/a/a1/sh_YU", temp.getLoadingStatus()); temp = bundle.getWithFallback("a/a4"); assertRootLoadingStatus("testdata/a/a4/sh_YU", temp.getLoadingStatus()); } public void TestCoverage(){ UResourceBundle bundle; bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME); if (bundle == null){ errln("UResourceBundle.getBundleInstance(String baseName) failed"); } bundle = null; bundle = UResourceBundle.getBundleInstance(ULocale.getDefault()); if (bundle == null){ errln("UResourceBundle.getBundleInstance(ULocale) failed"); return; } if (new UResourceTypeMismatchException("coverage") == null){ errln("Create UResourceTypeMismatchException error"); } class Stub extends UResourceBundle{ public ULocale getULocale() {return ULocale.ROOT;} protected String getLocaleID() {return null;} protected String getBaseName() {return null;} protected UResourceBundle getParent() {return null;} protected void setLoadingStatus(int newStatus) {} public Enumeration getKeys() {return null;} protected Object handleGetObject(String aKey) {return null;} } Stub stub = new Stub(); if (!stub.getLocale().equals(ULocale.ROOT.toLocale())){ errln("UResourceBundle.getLoclae(Locale) should delegate to (ULocale)"); } } public void TestJavaULocaleBundleLoading(){ String baseName="com.ibm.icu.dev.data.resources.TestDataElements"; String locName = "en_Latn_US"; UResourceBundle bundle = UResourceBundle.getBundleInstance(baseName, locName, testLoader); String fromRoot = bundle.getString("from_root"); if(!fromRoot.equals("This data comes from root")){ errln("Did not get the expected string for from_root"); } String fromEn = bundle.getString("from_en"); if(!fromEn.equals("This data comes from en")){ errln("Did not get the expected string for from_en"); } String fromEnLatn = bundle.getString("from_en_Latn"); if(!fromEnLatn.equals("This data comes from en_Latn")){ errln("Did not get the expected string for from_en_Latn"); } String fromEnLatnUs = bundle.getString("from_en_Latn_US"); if(!fromEnLatnUs.equals("This data comes from en_Latn_US")){ errln("Did not get the expected string for from_en_Latn_US"); } UResourceBundle bundle1 = UResourceBundle.getBundleInstance(baseName, new ULocale(locName), testLoader); if(!bundle1.equals(bundle)){ errln("Did not get the expected bundle for "+baseName +"."+locName); } if(bundle1!=bundle){ errln("Did not load the bundle from cache"); } UResourceBundle bundle2 = UResourceBundle.getBundleInstance(baseName, "en_IN", testLoader); if(!bundle2.getLocale().toString().equals("en")){ errln("Did not get the expected fallback locale. Expected: en Got: "+bundle2.getLocale().toString()); } UResourceBundle bundle3 = UResourceBundle.getBundleInstance(baseName, "te_IN", testLoader); if(!bundle3.getLocale().toString().equals("te")){ errln("Did not get the expected fallback locale. Expected: te Got: "+bundle2.getLocale().toString()); } // non-existent bundle .. should return default UResourceBundle defaultBundle = UResourceBundle.getBundleInstance(baseName, "hi_IN", testLoader); ULocale defaultLocale = ULocale.getDefault(); if(!defaultBundle.getULocale().equals(defaultLocale)){ errln("Did not get the default bundle for non-existent bundle"); } // non-existent bundle, non-existent default locale // so return the root bundle. ULocale.setDefault(ULocale.CANADA_FRENCH); UResourceBundle root = UResourceBundle.getBundleInstance(baseName, "hi_IN", testLoader); if(!root.getULocale().toString().equals("")){ errln("Did not get the root bundle for non-existent default bundle for non-existent bundle"); } //reset the default ULocale.setDefault(defaultLocale); Enumeration keys = bundle.getKeys(); int i=0; while(keys.hasMoreElements()){ logln("key: "+ keys.nextElement()); i++; } if(i!=4){ errln("Did not get the expected number of keys: got " + i + ", expected 4"); } UResourceBundle bundle4 = UResourceBundle.getBundleInstance(baseName,"fr_Latn_FR", testLoader); if(bundle4==null){ errln("Could not load bundle fr_Latn_FR"); } } public void TestAliasFallback(){ try{ ULocale loc = new ULocale("en_US"); ICUResourceBundle b = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, loc); ICUResourceBundle b1 = (ICUResourceBundle)b.getWithFallback("calendar/hebrew/monthNames/format/abbreviated"); if(b1!=null){ logln("loaded data for abbreviated month names: "+ b1.getKey()); } }catch(MissingResourceException ex){ warnln("Failed to load data for abbreviated month names"); } } private Set setFromEnumeration(Enumeration e) { TreeSet set = new TreeSet(); while (e.hasMoreElements()) { set.add(e.nextElement()); } return set; } /** * Test ICUResourceBundle.getKeys() for a whole bundle (top-level resource). * JDK JavaDoc for ResourceBundle.getKeys() says that it returns * "an Enumeration of the keys contained in this ResourceBundle and its parent bundles." */ public void TestICUGetKeysAtTopLevel() { String baseName="com/ibm/icu/dev/data/testdata"; UResourceBundle te_IN = UResourceBundle.getBundleInstance(baseName, "te_IN", testLoader); UResourceBundle te = UResourceBundle.getBundleInstance(baseName, "te", testLoader); Set te_set = setFromEnumeration(te.getKeys()); Set te_IN_set = setFromEnumeration(te_IN.getKeys()); assertTrue("te.getKeys().contains(string_only_in_Root)", te_set.contains("string_only_in_Root")); assertTrue("te.getKeys().contains(string_only_in_te)", te_set.contains("string_only_in_te")); assertFalse("te.getKeys().contains(string_only_in_te_IN)", te_set.contains("string_only_in_te_IN")); assertTrue("te_IN.getKeys().contains(string_only_in_Root)", te_IN_set.contains("string_only_in_Root")); assertTrue("te_IN.getKeys().contains(string_only_in_te)", te_IN_set.contains("string_only_in_te")); assertTrue("te_IN.getKeys().contains(string_only_in_te_IN)", te_IN_set.contains("string_only_in_te_IN")); // TODO: Check for keys of alias resource items } /** * Test ICUResourceBundle.getKeys() for a resource item (not a whole bundle/top-level resource). * This does not take parent bundles into account. */ public void TestICUGetKeysForResourceItem() { String baseName="com/ibm/icu/dev/data/testdata"; UResourceBundle te = UResourceBundle.getBundleInstance(baseName, "te", testLoader); UResourceBundle tagged_array_in_Root_te = te.get("tagged_array_in_Root_te"); Set keys = setFromEnumeration(tagged_array_in_Root_te.getKeys()); assertTrue("tagged_array_in_Root_te.getKeys().contains(tag0)", keys.contains("tag0")); assertTrue("tagged_array_in_Root_te.getKeys().contains(tag1)", keys.contains("tag1")); assertFalse("tagged_array_in_Root_te.getKeys().contains(tag7)", keys.contains("tag7")); assertFalse("tagged_array_in_Root_te.getKeys().contains(tag12)", keys.contains("tag12")); UResourceBundle array_in_Root_te = te.get("array_in_Root_te"); assertFalse("array_in_Root_te.getKeys().hasMoreElements()", array_in_Root_te.getKeys().hasMoreElements()); UResourceBundle string_in_Root_te = te.get("string_in_Root_te"); assertFalse("string_in_Root_te.getKeys().hasMoreElements()", string_in_Root_te.getKeys().hasMoreElements()); } /* * UResouceBundle should be able to load a resource bundle even if * a similarly named class (only case differences) exists in the * same package. See Ticket#6844 */ public void TestT6844() { try { UResourceBundle rb1 = UResourceBundle.getBundleInstance("com.ibm.icu.dev.data.resources.TestMessages"); assertEquals("bundleContainer in TestMessages", "TestMessages.class", rb1.getString("bundleContainer")); UResourceBundle rb2 = UResourceBundle.getBundleInstance("com.ibm.icu.dev.data.resources.testmessages"); assertEquals("bundleContainer in testmessages", "testmessages.properties", rb2.getString("bundleContainer")); } catch (Throwable t) { errln(t.getMessage()); } } }