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 4833268 6253991 8008577
27 * @summary Test formatting and parsing with non-Gregorian calendars
28 * @run main/othervm -Djava.locale.providers=COMPAT,SPI NonGregorianFormatTest
29 */
30
31 import java.util.*;
32 import java.text.*;
33 import static java.util.Calendar.*;
34
35 public class NonGregorianFormatTest {
36 static int errors;
37
38 static final Object[][] JAPANESE_EN = {
39 { "GGGG yyyy MMMM d", "Showa 1 December 31", new Date(1926-1900, DECEMBER, 31) },
40 { "GGGG yyyy MMMM d", "Showa 64 January 6", new Date(1989-1900, JANUARY, 6) },
41 { "GGGG yyyy MMMM d", "Heisei 1 August 9", new Date(1989-1900, AUGUST, 9) },
42 { "GGGG yyyy MMMM d", "Heisei 17 June 10", new Date(2005-1900, JUNE, 10) },
43 { "Gy.MM.dd", "S1.12.31", new Date(1926-1900, DECEMBER, 31) },
44 { "Gy.MM.dd", "S64.01.06", new Date(1989-1900, JANUARY, 6) },
45 { "Gyy.MM.dd", "H01.08.09", new Date(1989-1900, AUGUST, 9) },
46 { "Gy.M.d", "H1.8.9", new Date(1989-1900, AUGUST, 9) },
47 { "Gy.MM.dd", "H17.06.10", new Date(2005-1900, JUNE, 10) },
|
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 4833268 6253991 8008577
27 * @summary Test formatting and parsing with non-Gregorian calendars
28 * @modules jdk.localedata
29 * @run main/othervm -Djava.locale.providers=COMPAT,SPI NonGregorianFormatTest
30 */
31
32 import java.util.*;
33 import java.text.*;
34 import static java.util.Calendar.*;
35
36 public class NonGregorianFormatTest {
37 static int errors;
38
39 static final Object[][] JAPANESE_EN = {
40 { "GGGG yyyy MMMM d", "Showa 1 December 31", new Date(1926-1900, DECEMBER, 31) },
41 { "GGGG yyyy MMMM d", "Showa 64 January 6", new Date(1989-1900, JANUARY, 6) },
42 { "GGGG yyyy MMMM d", "Heisei 1 August 9", new Date(1989-1900, AUGUST, 9) },
43 { "GGGG yyyy MMMM d", "Heisei 17 June 10", new Date(2005-1900, JUNE, 10) },
44 { "Gy.MM.dd", "S1.12.31", new Date(1926-1900, DECEMBER, 31) },
45 { "Gy.MM.dd", "S64.01.06", new Date(1989-1900, JANUARY, 6) },
46 { "Gyy.MM.dd", "H01.08.09", new Date(1989-1900, AUGUST, 9) },
47 { "Gy.M.d", "H1.8.9", new Date(1989-1900, AUGUST, 9) },
48 { "Gy.MM.dd", "H17.06.10", new Date(2005-1900, JUNE, 10) },
|