< prev index next >

test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.java

Print this page


   1 /*
   2  * Copyright (c) 2012, 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  */
  26 
  27 import java.text.*;
  28 import java.util.*;
  29 import static java.util.Calendar.*;
  30 import sun.util.locale.provider.*;
  31 import sun.util.resources.*;
  32 import com.bar.CalendarNameProviderImpl;
  33 












  34 /**
  35  * Test case for CalendarNameProvider.
  36  *
  37  * Test strategy:
  38  * com.bar.CalendarNameProviderImpl supports only ja_JP_kids locale. It returns
  39  * month names only in full-width digits, followed by "gatsu" in Hiragana if
  40  * it's a long style. The standalone styles are used because DateFormatSymbols
  41  * has precedence for the format styles.
  42  *
  43  * Calendar.getDisplayName(s) should be called with kids to get the month
  44  * names provided by com.bar.CalendarNameProviderImpl. Other display names
  45  * should be the same as what a Calendar constructed with ja_JP returns.
  46  */
  47 public class CalendarNameProviderTest {
  48 
  49     public static void main(String[] s) {
  50         new CalendarNameProviderTest().test();
  51     }
  52 
  53     void test() {


   1 /*
   2  * Copyright (c) 2012, 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 8000986 8062588 8210406
  27  * @summary CalendarNameProvider tests
  28  * @library providersrc/foobarutils
  29  *          providersrc/barprovider
  30  * @build com.foobar.Utils
  31  *        com.bar.*
  32  * @run main/othervm -Djava.locale.providers=JRE,SPI CalendarNameProviderTest
  33  */
  34 
  35 import java.util.Calendar;
  36 import java.util.HashMap;
  37 import java.util.Locale;
  38 import java.util.Map;
  39 
  40 import com.bar.CalendarNameProviderImpl;
  41 
  42 import static java.util.Calendar.ALL_STYLES;
  43 import static java.util.Calendar.DAY_OF_MONTH;
  44 import static java.util.Calendar.DAY_OF_WEEK;
  45 import static java.util.Calendar.DECEMBER;
  46 import static java.util.Calendar.HOUR_OF_DAY;
  47 import static java.util.Calendar.JANUARY;
  48 import static java.util.Calendar.LONG_STANDALONE;
  49 import static java.util.Calendar.MONTH;
  50 import static java.util.Calendar.SATURDAY;
  51 import static java.util.Calendar.SHORT_STANDALONE;
  52 import static java.util.Calendar.SUNDAY;
  53 
  54 /**
  55  * Test case for CalendarNameProvider.
  56  *
  57  * Test strategy:
  58  * com.bar.CalendarNameProviderImpl supports only ja_JP_kids locale. It returns
  59  * month names only in full-width digits, followed by "gatsu" in Hiragana if
  60  * it's a long style. The standalone styles are used because DateFormatSymbols
  61  * has precedence for the format styles.
  62  *
  63  * Calendar.getDisplayName(s) should be called with kids to get the month
  64  * names provided by com.bar.CalendarNameProviderImpl. Other display names
  65  * should be the same as what a Calendar constructed with ja_JP returns.
  66  */
  67 public class CalendarNameProviderTest {
  68 
  69     public static void main(String[] s) {
  70         new CalendarNameProviderTest().test();
  71     }
  72 
  73     void test() {


< prev index next >