1 /* |
1 /* |
2 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
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. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
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 |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
|
24 import java.time.LocalDateTime; |
24 import java.util.*; |
25 import java.util.*; |
25 import static java.util.GregorianCalendar.*; |
26 import static java.util.GregorianCalendar.*; |
26 |
27 |
27 public class NarrowNamesTest { |
28 public class NarrowNamesTest { |
28 private static final Locale US = Locale.US; |
29 private static final Locale US = Locale.US; |
47 YEAR, 2012, MONTH, DECEMBER, DAY_OF_MONTH, 23); |
48 YEAR, 2012, MONTH, DECEMBER, DAY_OF_MONTH, 23); |
48 test(US, AM_PM, "a", |
49 test(US, AM_PM, "a", |
49 HOUR_OF_DAY, 10); |
50 HOUR_OF_DAY, 10); |
50 test(US, AM_PM, "p", |
51 test(US, AM_PM, "p", |
51 HOUR_OF_DAY, 23); |
52 HOUR_OF_DAY, 23); |
52 test(JAJPJP, DAY_OF_WEEK, "\u65e5", |
53 test(JAJPJP, DAY_OF_WEEK, |
|
54 LocalDateTime.now().isBefore(LocalDateTime.of(2019, 5, 1, 0, 0)) ? |
|
55 "\u65e5" : "\u706b", // "Sun" for HEISEI, "Tue" for NEWERA |
53 YEAR, 24, MONTH, DECEMBER, DAY_OF_MONTH, 23); |
56 YEAR, 24, MONTH, DECEMBER, DAY_OF_MONTH, 23); |
54 test(THTH, MONTH, NARROW_STANDALONE, "\u0e18.\u0e04.", |
57 test(THTH, MONTH, NARROW_STANDALONE, "\u0e18.\u0e04.", |
55 YEAR, 2555, MONTH, DECEMBER, DAY_OF_MONTH, 5); |
58 YEAR, 2555, MONTH, DECEMBER, DAY_OF_MONTH, 5); |
56 test(THTH, DAY_OF_WEEK, "\u0e1e", |
59 test(THTH, DAY_OF_WEEK, "\u0e1e", |
57 YEAR, 2555, MONTH, DECEMBER, DAY_OF_MONTH, 5); |
60 YEAR, 2555, MONTH, DECEMBER, DAY_OF_MONTH, 5); |