jdk/test/sun/util/resources/TimeZone/Bug6317929.java
changeset 2 90ce3da70b43
child 5305 02eb2f3cac63
equal deleted inserted replaced
0:fd16c54261b3 2:90ce3da70b43
       
     1 /*
       
     2  * Copyright (c) 2007 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
       
    21  * have any 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            ("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                                        "\"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 solare 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 solare 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            ("Eastern Standard Time (Nya Sydwales)"))
       
   184             throw new RuntimeException("\n" + tzLocale + ": LONG, " +
       
   185                                        "non-daylight saving name for " +
       
   186                                        "Australia/Currie should be " +
       
   187                                        "\"Eastern Standard Time " +
       
   188                                        "(Nya Sydwales)\"");
       
   189         tzLocale = locales2Test[8];
       
   190         if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals
       
   191            ("\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4\uff08\u65b0\u5357\u5a01\u5c14\u65af\uff09"))
       
   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                                        "\uff08\u65b0\u5357\u5a01\u5c14\u65af\uff09\"");
       
   197         tzLocale = locales2Test[9];
       
   198         if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals
       
   199            ("\u6771\u65b9\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\u65b9\u6a19\u6e96\u6642\u9593 " +
       
   204                                        "(\u65b0\u5357\u5a01\u723e\u65af)\"");
       
   205    }
       
   206 }