Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/util/resources/TimeZone/Bug6317929.java
38853 views
/*1* Copyright (c) 2007, 2013, 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 640941926*@summary Test case for tzdata2005m support for 9 locales27*/2829import java.util.Locale;30import java.util.TimeZone;3132public class Bug6317929 {33static Locale[] locales2Test = new Locale[] {34new Locale("en"),35new Locale("de"),36new Locale("es"),37new Locale("fr"),38new Locale("it"),39new Locale("ja"),40new Locale("ko"),41new Locale("sv"),42new Locale("zh","CN"),43new Locale("zh","TW")44};4546public static void main(String[] args) {47Locale tzLocale;4849TimeZone Coral_Harbour = TimeZone.getTimeZone("America/Coral_Harbour");50tzLocale = locales2Test[0];51if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals52("Eastern Standard Time"))53throw new RuntimeException("\n" + tzLocale + ": LONG, " +54"non-daylight saving name for " +55"America/Coral_Harbour should be " +56"\"Eastern Standard Time\"");57tzLocale = locales2Test[1];58if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals59("\u00d6stliche Normalzeit"))60throw new RuntimeException("\n" + tzLocale + ": LONG, " +61"non-daylight saving name for " +62"America/Coral_Harbour should be " +63"\"\u00d6stliche Normalzeit\"");64tzLocale = locales2Test[2];65if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals66("Hora est\u00e1ndar Oriental"))67throw new RuntimeException("\n" + tzLocale + ": LONG, " +68"non-daylight saving name for " +69"America/Coral_Harbour should be " +70"\"Hora est\u00e1ndar Oriental\"");71tzLocale = locales2Test[3];72if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals73("Heure normale de l'Est"))74throw new RuntimeException("\n" + tzLocale + ": LONG, " +75"non-daylight saving name for " +76"America/Coral_Harbour should be " +77"\"Heure normale de l'Est\"");78tzLocale = locales2Test[4];79if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals80("Ora solare USA orientale"))81throw new RuntimeException("\n" + tzLocale + ": LONG, " +82"non-daylight saving name for " +83"America/Coral_Harbour should be " +84"\"Ora solare USA orientale\"");85tzLocale = locales2Test[5];86if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals87("\u6771\u90e8\u6a19\u6e96\u6642"))88throw new RuntimeException("\n" + tzLocale + ": LONG, " +89"non-daylight saving name for " +90"America/Coral_Harbour should be " +91"\"\u6771\u90e8\u6a19\u6e96\u6642\"");92tzLocale = locales2Test[6];93if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals94("\ub3d9\ubd80 \ud45c\uc900\uc2dc"))95throw new RuntimeException("\n" + tzLocale + ": LONG, " +96"non-daylight saving name for " +97"America/Coral_Harbour should be " +98"\"\ub3d9\ubd80 \ud45c\uc900\uc2dc\"");99tzLocale = locales2Test[7];100if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals101("Eastern, normaltid"))102throw new RuntimeException("\n" + tzLocale + ": LONG, " +103"non-daylight saving name for " +104"America/Coral_Harbour should be " +105"\"Eastern, normaltid\"");106tzLocale = locales2Test[8];107if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals108("\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4"))109throw new RuntimeException("\n" + tzLocale + ": LONG, " +110"non-daylight saving name for " +111"America/Coral_Harbour should be " +112"\"\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4\"");113tzLocale = locales2Test[9];114if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals115("\u6771\u65b9\u6a19\u6e96\u6642\u9593"))116throw new RuntimeException("\n" + tzLocale + ": LONG, " +117"non-daylight saving name for " +118"America/Coral_Harbour should be " +119"\"\u6771\u65b9\u6a19\u6e96\u6642\u9593\"");120121TimeZone Currie = TimeZone.getTimeZone("Australia/Currie");122tzLocale = locales2Test[0];123if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals124("Australian Eastern Standard Time (New South Wales)"))125throw new RuntimeException("\n" + tzLocale + ": LONG, " +126"non-daylight saving name for " +127"Australia/Currie should be " +128"\"Australian Eastern Standard Time " +129"(New South Wales)\"");130tzLocale = locales2Test[1];131if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals132("\u00D6stliche Normalzeit (New South Wales)"))133throw new RuntimeException("\n" + tzLocale + ": LONG, " +134"non-daylight saving name for " +135"Australia/Currie should be " +136"\"\u00D6stliche Normalzeit " +137"(New South Wales)\"");138tzLocale = locales2Test[2];139if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals140("Hora est\u00e1ndar Oriental (Nueva Gales del Sur)"))141throw new RuntimeException("\n" + tzLocale + ": LONG, " +142"non-daylight saving name for " +143"Australia/Currie should be " +144"\"Hora est\u00e1ndar Oriental " +145"(Nueva Gales del Sur)\"");146tzLocale = locales2Test[3];147if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals148("Heure normale de l'Est (Nouvelle-Galles du Sud)"))149throw new RuntimeException("\n" + tzLocale + ": LONG, " +150"non-daylight saving name for " +151"Australia/Currie should be " +152"\"Heure normale de l'Est " +153"(Nouvelle-Galles du Sud)\"");154tzLocale = locales2Test[4];155if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals156("Ora standard dell'Australia orientale (Nuovo Galles del Sud)"))157throw new RuntimeException("\n" + tzLocale + ": LONG, " +158"non-daylight saving name for " +159"Australia/Currie should be " +160"\"Ora standard dell'Australia orientale " +161"(Nuovo Galles del Sud)\"");162tzLocale = locales2Test[5];163if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals164("\u6771\u90E8\u6A19\u6E96\u6642" +165"(\u30CB\u30E5\u30FC\u30B5\u30A6\u30B9\u30A6\u30A7\u30FC\u30EB\u30BA)"))166throw new RuntimeException("\n" + tzLocale + ": LONG, " +167"non-daylight saving name for " +168"Australia/Currie should be " +169"\"\u6771\u90E8\u6A19\u6E96\u6642" +170"(\u30CB\u30E5\u30FC\u30B5\u30A6\u30B9" +171"\u30A6\u30A7\u30FC\u30EB\u30BA)\"");172tzLocale = locales2Test[6];173if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals174("\uB3D9\uBD80 \uD45C\uC900\uC2DC(\uB274\uC0AC\uC6B0\uC2A4\uC6E8\uC77C\uC988)"))175throw new RuntimeException("\n" + tzLocale + ": LONG, " +176"non-daylight saving name for " +177"Australia/Currie should be " +178"\"\uB3D9\uBD80 \uD45C\uC900\uC2DC" +179"(\uB274\uC0AC\uC6B0\uC2A4\uC6E8\uC77C\uC988)\"");180tzLocale = locales2Test[7];181if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals182("\u00D6stlig standardtid (New South Wales)"))183throw new RuntimeException("\n" + tzLocale + ": LONG, " +184"non-daylight saving name for " +185"Australia/Currie should be " +186"\"\u00D6stlig standardtid " +187"(New South Wales)\"");188tzLocale = locales2Test[8];189if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals190("\u4E1C\u90E8\u6807\u51C6\u65F6\u95F4 (\u65B0\u5357\u5A01\u5C14\u65AF)"))191throw new RuntimeException("\n" + tzLocale + ": LONG, " +192"non-daylight saving name for " +193"Australia/Currie should be " +194"\"\u4E1C\u90E8\u6807\u51C6\u65F6\u95F4 " +195"(\u65B0\u5357\u5A01\u5C14\u65AF)\"");196tzLocale = locales2Test[9];197if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals198("\u6771\u90E8\u6A19\u6E96\u6642\u9593 (\u65B0\u5357\u5A01\u723E\u65AF)"))199throw new RuntimeException("\n" + tzLocale + ": LONG, " +200"non-daylight saving name for " +201"Australia/Currie should be " +202"\"\u6771\u90E8\u6A19\u6E96\u6642\u9593 " +203"(\u65B0\u5357\u5A01\u723E\u65AF)\"");204}205}206207208