Path: blob/master/test/jdk/sun/util/resources/TimeZone/Bug6317929.java
41154 views
/*1* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 6317929 6409419 800857726* @modules jdk.localedata27* @summary Test case for tzdata2005m support for 9 locales28* @run main/othervm -Djava.locale.providers=JRE,SPI Bug631792929*/3031import java.util.Locale;32import java.util.TimeZone;3334public class Bug6317929 {35static Locale[] locales2Test = new Locale[] {36new Locale("en"),37new Locale("de"),38new Locale("es"),39new Locale("fr"),40new Locale("it"),41new Locale("ja"),42new Locale("ko"),43new Locale("sv"),44new Locale("zh","CN"),45new Locale("zh","TW")46};4748public static void main(String[] args) {49Locale tzLocale;5051TimeZone Coral_Harbour = TimeZone.getTimeZone("America/Coral_Harbour");52tzLocale = locales2Test[0];53if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals54("Eastern Standard Time"))55throw new RuntimeException("\n" + tzLocale + ": LONG, " +56"non-daylight saving name for " +57"America/Coral_Harbour should be " +58"\"Eastern Standard Time\"");59tzLocale = locales2Test[1];60if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals61("\u00d6stliche Normalzeit"))62throw new RuntimeException("\n" + tzLocale + ": LONG, " +63"non-daylight saving name for " +64"America/Coral_Harbour should be " +65"\"\u00d6stliche Normalzeit\"");66tzLocale = locales2Test[2];67if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals68("Hora est\u00e1ndar Oriental"))69throw new RuntimeException("\n" + tzLocale + ": LONG, " +70"non-daylight saving name for " +71"America/Coral_Harbour should be " +72"\"Hora est\u00e1ndar Oriental\"");73tzLocale = locales2Test[3];74if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals75("Heure normale de l'Est"))76throw new RuntimeException("\n" + tzLocale + ": LONG, " +77"non-daylight saving name for " +78"America/Coral_Harbour should be " +79"\"Heure normale de l'Est\"");80tzLocale = locales2Test[4];81if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals82("Ora solare USA orientale"))83throw new RuntimeException("\n" + tzLocale + ": LONG, " +84"non-daylight saving name for " +85"America/Coral_Harbour should be " +86"\"Ora solare USA orientale\"");87tzLocale = locales2Test[5];88if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals89("\u6771\u90e8\u6a19\u6e96\u6642"))90throw new RuntimeException("\n" + tzLocale + ": LONG, " +91"non-daylight saving name for " +92"America/Coral_Harbour should be " +93"\"\u6771\u90e8\u6a19\u6e96\u6642\"");94tzLocale = locales2Test[6];95if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals96("\ub3d9\ubd80 \ud45c\uc900\uc2dc"))97throw new RuntimeException("\n" + tzLocale + ": LONG, " +98"non-daylight saving name for " +99"America/Coral_Harbour should be " +100"\"\ub3d9\ubd80 \ud45c\uc900\uc2dc\"");101tzLocale = locales2Test[7];102if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals103("Eastern, normaltid"))104throw new RuntimeException("\n" + tzLocale + ": LONG, " +105"non-daylight saving name for " +106"America/Coral_Harbour should be " +107"\"Eastern, normaltid\"");108tzLocale = locales2Test[8];109if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals110("\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4"))111throw new RuntimeException("\n" + tzLocale + ": LONG, " +112"non-daylight saving name for " +113"America/Coral_Harbour should be " +114"\"\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4\"");115tzLocale = locales2Test[9];116if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals117("\u6771\u65b9\u6a19\u6e96\u6642\u9593"))118throw new RuntimeException("\n" + tzLocale + ": LONG, " +119"non-daylight saving name for " +120"America/Coral_Harbour should be " +121"\"\u6771\u65b9\u6a19\u6e96\u6642\u9593\"");122123TimeZone Currie = TimeZone.getTimeZone("Australia/Currie");124tzLocale = locales2Test[0];125if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals126("Australian Eastern Standard Time (New South Wales)"))127throw new RuntimeException("\n" + tzLocale + ": LONG, " +128"non-daylight saving name for " +129"Australia/Currie should be " +130"\"Australian Eastern Standard Time " +131"(New South Wales)\"");132tzLocale = locales2Test[1];133if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals134("\u00D6stliche Normalzeit (New South Wales)"))135throw new RuntimeException("\n" + tzLocale + ": LONG, " +136"non-daylight saving name for " +137"Australia/Currie should be " +138"\"\u00D6stliche Normalzeit " +139"(New South Wales)\"");140tzLocale = locales2Test[2];141if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals142("Hora est\u00e1ndar Oriental (Nueva Gales del Sur)"))143throw new RuntimeException("\n" + tzLocale + ": LONG, " +144"non-daylight saving name for " +145"Australia/Currie should be " +146"\"Hora est\u00e1ndar Oriental " +147"(Nueva Gales del Sur)\"");148tzLocale = locales2Test[3];149if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals150("Heure normale de l'Est (Nouvelle-Galles du Sud)"))151throw new RuntimeException("\n" + tzLocale + ": LONG, " +152"non-daylight saving name for " +153"Australia/Currie should be " +154"\"Heure normale de l'Est " +155"(Nouvelle-Galles du Sud)\"");156tzLocale = locales2Test[4];157if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals158("Ora standard dell'Australia orientale (Nuovo Galles del Sud)"))159throw new RuntimeException("\n" + tzLocale + ": LONG, " +160"non-daylight saving name for " +161"Australia/Currie should be " +162"\"Ora standard dell'Australia orientale " +163"(Nuovo Galles del Sud)\"");164tzLocale = locales2Test[5];165if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals166("\u6771\u90E8\u6A19\u6E96\u6642" +167"(\u30CB\u30E5\u30FC\u30B5\u30A6\u30B9\u30A6\u30A7\u30FC\u30EB\u30BA)"))168throw new RuntimeException("\n" + tzLocale + ": LONG, " +169"non-daylight saving name for " +170"Australia/Currie should be " +171"\"\u6771\u90E8\u6A19\u6E96\u6642" +172"(\u30CB\u30E5\u30FC\u30B5\u30A6\u30B9" +173"\u30A6\u30A7\u30FC\u30EB\u30BA)\"");174tzLocale = locales2Test[6];175if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals176("\uB3D9\uBD80 \uD45C\uC900\uC2DC(\uB274\uC0AC\uC6B0\uC2A4\uC6E8\uC77C\uC988)"))177throw new RuntimeException("\n" + tzLocale + ": LONG, " +178"non-daylight saving name for " +179"Australia/Currie should be " +180"\"\uB3D9\uBD80 \uD45C\uC900\uC2DC" +181"(\uB274\uC0AC\uC6B0\uC2A4\uC6E8\uC77C\uC988)\"");182tzLocale = locales2Test[7];183if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals184("\u00D6stlig standardtid (New South Wales)"))185throw new RuntimeException("\n" + tzLocale + ": LONG, " +186"non-daylight saving name for " +187"Australia/Currie should be " +188"\"\u00D6stlig standardtid " +189"(New South Wales)\"");190tzLocale = locales2Test[8];191if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals192("\u4E1C\u90E8\u6807\u51C6\u65F6\u95F4 (\u65B0\u5357\u5A01\u5C14\u65AF)"))193throw new RuntimeException("\n" + tzLocale + ": LONG, " +194"non-daylight saving name for " +195"Australia/Currie should be " +196"\"\u4E1C\u90E8\u6807\u51C6\u65F6\u95F4 " +197"(\u65B0\u5357\u5A01\u5C14\u65AF)\"");198tzLocale = locales2Test[9];199if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals200("\u6771\u90E8\u6A19\u6E96\u6642\u9593 (\u65B0\u5357\u5A01\u723E\u65AF)"))201throw new RuntimeException("\n" + tzLocale + ": LONG, " +202"non-daylight saving name for " +203"Australia/Currie should be " +204"\"\u6771\u90E8\u6A19\u6E96\u6642\u9593 " +205"(\u65B0\u5357\u5A01\u723E\u65AF)\"");206}207}208209210