< prev index next >

test/jdk/java/util/TimeZone/TimeZoneTest.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2018, 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 4028006 4044013 4096694 4107276 4107570 4112869 4130885 7039469 7126465 7158483
  27  *      8008577 8077685 8098547 8133321 8138716 8148446 8151876 8159684 8166875 8181157

  28  * @modules java.base/sun.util.resources
  29  * @library /java/text/testlib
  30  * @summary test TimeZone
  31  */
  32 
  33 import java.io.*;
  34 import java.text.*;
  35 import java.util.*;
  36 import sun.util.resources.LocaleData;
  37 
  38 public class TimeZoneTest extends IntlTest
  39 {
  40     static final int millisPerHour = 3600000;
  41 
  42     public static void main(String[] args) throws Exception {
  43         new TimeZoneTest().run(args);
  44     }
  45 
  46     /**
  47      * Bug 4130885


  96      *
  97      * + A zone with the correct name already exists and means something
  98      * else. E.g., EST usually indicates the US Eastern zone, so it cannot be
  99      * used for Brazil (BET).
 100      */
 101     public void TestShortZoneIDs() throws Exception {
 102 
 103         ZoneDescriptor[] JDK_116_REFERENCE_LIST = {
 104             new ZoneDescriptor("MIT", 780, true),
 105             new ZoneDescriptor("HST", -600, false),
 106             new ZoneDescriptor("AST", -540, true),
 107             new ZoneDescriptor("PST", -480, true),
 108             new ZoneDescriptor("PNT", -420, false),
 109             new ZoneDescriptor("MST", -420, false),
 110             new ZoneDescriptor("CST", -360, true),
 111             new ZoneDescriptor("IET", -300, true),
 112             new ZoneDescriptor("EST", -300, false),
 113             new ZoneDescriptor("PRT", -240, false),
 114             new ZoneDescriptor("CNT", -210, true),
 115             new ZoneDescriptor("AGT", -180, false),
 116             new ZoneDescriptor("BET", -180, true),
 117             // new ZoneDescriptor("CAT", -60, false), // Wrong:
 118             // As of bug 4130885, fix CAT (Central Africa)
 119             new ZoneDescriptor("CAT", 120, false), // Africa/Harare
 120             new ZoneDescriptor("GMT", 0, false),
 121             new ZoneDescriptor("UTC", 0, false),
 122             new ZoneDescriptor("ECT", 60, true),
 123             new ZoneDescriptor("ART", 120, false),
 124             new ZoneDescriptor("EET", 120, true),
 125             new ZoneDescriptor("EAT", 180, false),
 126             new ZoneDescriptor("MET", 60, true),
 127             new ZoneDescriptor("NET", 240, false),
 128             new ZoneDescriptor("PLT", 300, false),
 129             new ZoneDescriptor("IST", 330, false),
 130             new ZoneDescriptor("BST", 360, false),
 131             new ZoneDescriptor("VST", 420, false),
 132             new ZoneDescriptor("CTT", 480, false),
 133             new ZoneDescriptor("JST", 540, false),
 134             new ZoneDescriptor("ACT", 570, false),
 135             new ZoneDescriptor("AET", 600, true),
 136             new ZoneDescriptor("SST", 660, false),


   1 /*
   2  * Copyright (c) 1997, 2019, 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 4028006 4044013 4096694 4107276 4107570 4112869 4130885 7039469 7126465 7158483
  27  *      8008577 8077685 8098547 8133321 8138716 8148446 8151876 8159684 8166875 8181157
  28  *      8228469
  29  * @modules java.base/sun.util.resources
  30  * @library /java/text/testlib
  31  * @summary test TimeZone
  32  */
  33 
  34 import java.io.*;
  35 import java.text.*;
  36 import java.util.*;
  37 import sun.util.resources.LocaleData;
  38 
  39 public class TimeZoneTest extends IntlTest
  40 {
  41     static final int millisPerHour = 3600000;
  42 
  43     public static void main(String[] args) throws Exception {
  44         new TimeZoneTest().run(args);
  45     }
  46 
  47     /**
  48      * Bug 4130885


  97      *
  98      * + A zone with the correct name already exists and means something
  99      * else. E.g., EST usually indicates the US Eastern zone, so it cannot be
 100      * used for Brazil (BET).
 101      */
 102     public void TestShortZoneIDs() throws Exception {
 103 
 104         ZoneDescriptor[] JDK_116_REFERENCE_LIST = {
 105             new ZoneDescriptor("MIT", 780, true),
 106             new ZoneDescriptor("HST", -600, false),
 107             new ZoneDescriptor("AST", -540, true),
 108             new ZoneDescriptor("PST", -480, true),
 109             new ZoneDescriptor("PNT", -420, false),
 110             new ZoneDescriptor("MST", -420, false),
 111             new ZoneDescriptor("CST", -360, true),
 112             new ZoneDescriptor("IET", -300, true),
 113             new ZoneDescriptor("EST", -300, false),
 114             new ZoneDescriptor("PRT", -240, false),
 115             new ZoneDescriptor("CNT", -210, true),
 116             new ZoneDescriptor("AGT", -180, false),
 117             new ZoneDescriptor("BET", -180, false),
 118             // new ZoneDescriptor("CAT", -60, false), // Wrong:
 119             // As of bug 4130885, fix CAT (Central Africa)
 120             new ZoneDescriptor("CAT", 120, false), // Africa/Harare
 121             new ZoneDescriptor("GMT", 0, false),
 122             new ZoneDescriptor("UTC", 0, false),
 123             new ZoneDescriptor("ECT", 60, true),
 124             new ZoneDescriptor("ART", 120, false),
 125             new ZoneDescriptor("EET", 120, true),
 126             new ZoneDescriptor("EAT", 180, false),
 127             new ZoneDescriptor("MET", 60, true),
 128             new ZoneDescriptor("NET", 240, false),
 129             new ZoneDescriptor("PLT", 300, false),
 130             new ZoneDescriptor("IST", 330, false),
 131             new ZoneDescriptor("BST", 360, false),
 132             new ZoneDescriptor("VST", 420, false),
 133             new ZoneDescriptor("CTT", 480, false),
 134             new ZoneDescriptor("JST", 540, false),
 135             new ZoneDescriptor("ACT", 570, false),
 136             new ZoneDescriptor("AET", 600, true),
 137             new ZoneDescriptor("SST", 660, false),


< prev index next >