< prev index next >
test/java/util/Calendar/SupplementalJapaneseEraTest.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 21,30 ****
--- 21,32 ----
* questions.
*/
import java.text.SimpleDateFormat;
import java.time.chrono.JapaneseDate;
+ import java.time.chrono.JapaneseEra;
+ import java.time.format.TextStyle;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import static java.util.GregorianCalendar.*;
import java.util.Locale;
*** 138,147 ****
--- 140,161 ----
expected = "Japanese " + NEW_ERA_NAME + " 1-02-11";
if (!expected.equals(got)) {
System.err.printf("JapaneseDate: got=\"%s\", expected=\"%s\"%n", got, expected);
errors++;
}
+ JapaneseEra jera = jdate.getEra();
+ got = jera.getDisplayName(TextStyle.FULL, Locale.US);
+ if (!NEW_ERA_NAME.equals(got)) {
+ System.err.printf("JapaneseEra (FULL): got=\"%s\", expected=\"%s\"%n", got, NEW_ERA_NAME);
+ errors++;
+ }
+ got = jera.getDisplayName(TextStyle.SHORT, Locale.US);
+ if (!NEW_ERA_ABBR.equals(got)) {
+ System.err.printf("JapaneseEra (SHORT): got=\"%s\", expected=\"%s\"%n", got, NEW_ERA_ABBR);
+ errors++;
+ }
+
}
private static void testValidation(String eraName) {
Calendar jcal = new Calendar.Builder()
.setCalendarType("japanese")
< prev index next >