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