--- a/jdk/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java Sun Dec 09 19:13:08 2012 +0000
+++ b/jdk/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java Mon Dec 10 10:52:11 2012 +0900
@@ -40,6 +40,7 @@
TimeZoneNameProviderTest() {
test1();
test2();
+ test3();
aliasTest();
}
@@ -92,6 +93,7 @@
final String pattern = "z";
final Locale OSAKA = new Locale("ja", "JP", "osaka");
final Locale KYOTO = new Locale("ja", "JP", "kyoto");
+ final Locale GENERIC = new Locale("ja", "JP", "generic");
final String[] TIMEZONES = {
"GMT", "America/Los_Angeles", "SystemV/PST8",
@@ -157,6 +159,29 @@
}
}
+ void test3() {
+ final String[] TZNAMES = {
+ LATIME, PST, PST8PDT, US_PACIFIC,
+ TOKYOTIME, JST, JAPAN,
+ };
+ for (String tzname : TZNAMES) {
+ TimeZone tz = TimeZone.getTimeZone(tzname);
+ for (int style : new int[] { TimeZone.LONG, TimeZone.SHORT }) {
+ String osakaStd = tz.getDisplayName(false, style, OSAKA);
+ if (osakaStd != null) {
+ // No API for getting generic time zone names
+ String generic = TimeZoneNameUtility.retrieveGenericDisplayName(tzname,
+ style, GENERIC);
+ String expected = "Generic " + osakaStd;
+ if (!expected.equals(generic)) {
+ throw new RuntimeException("Wrong generic name: got=\"" + generic
+ + "\", expected=\"" + expected + "\"");
+ }
+ }
+ }
+ }
+ }
+
final String LATIME = "America/Los_Angeles";
final String PST = "PST";
final String PST8PDT = "PST8PDT";