< prev index next >

test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java

Print this page

        

@@ -19,13 +19,13 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
-/*
+ /*
  * @test
- * @bug 8005471 8008577 8129881 8130845 8136518 8181157
+ * @bug 8005471 8008577 8129881 8130845 8136518 8181157 8210490
  * @modules jdk.localedata
  * @run main/othervm -Djava.locale.providers=CLDR CLDRDisplayNamesTest
  * @summary Make sure that localized time zone names of CLDR are used
  * if specified.
  */

@@ -115,10 +115,21 @@
             errors++;
         } finally {
             Locale.setDefault(originalLocale);
         }
 
+        // for 8210490
+        // Check that TimeZone.getDisplayName should honor passed locale parameter,
+        // even if default locale is set to some other locale.
+        Locale.setDefault(Locale.forLanguageTag("ar-PK"));
+        TimeZone zi = TimeZone.getTimeZone("Etc/GMT-5");
+        String displayName = zi.getDisplayName(false, TimeZone.SHORT, Locale.US);
+        Locale.setDefault(originalLocale);
+        if (!displayName.equals("GMT+05:00")) {
+            System.err.printf("Wrong display name for timezone Etc/GMT-5 : expected GMT+05:00,  Actual " + displayName);
+            errors++;
+        }
         if (errors > 0) {
             throw new RuntimeException("test failed");
         }
     }
 }
< prev index next >