test/java/time/test/java/time/temporal/TestJapaneseChronoImpl.java

Print this page

        

*** 61,76 **** import java.util.Calendar; import java.util.Locale; import java.util.TimeZone; import java.time.LocalDate; import java.time.LocalTime; ! import java.time.temporal.OffsetDateTime; import java.time.ZoneOffset; import java.time.temporal.ChronoField; ! import java.time.temporal.ChronoLocalDate; import java.time.temporal.ChronoUnit; ! import java.time.calendar.JapaneseChrono; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** --- 61,77 ---- import java.util.Calendar; import java.util.Locale; import java.util.TimeZone; import java.time.LocalDate; import java.time.LocalTime; ! import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.time.temporal.ChronoField; ! import java.time.chrono.ChronoLocalDate; import java.time.temporal.ChronoUnit; ! import java.time.chrono.JapaneseChronology; ! import java.time.chrono.JapaneseDate; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /**
*** 98,108 **** assertEquals(locale.toString(), "ja_JP_#u-ca-japanese", "Unexpected locale"); Calendar cal = java.util.Calendar.getInstance(locale); assertEquals(cal.getCalendarType(), "japanese", "Unexpected calendar type"); ! ChronoLocalDate<JapaneseChrono> jDate = JapaneseChrono.INSTANCE.date(isoStartDate); // Convert to millis and set Japanese Calendar to that start date (at GMT) OffsetDateTime jodt = OffsetDateTime.of(isoStartDate, LocalTime.MIN, ZoneOffset.UTC); long millis = jodt.toInstant().toEpochMilli(); cal.setTimeZone(TimeZone.getTimeZone("GMT+00")); --- 99,109 ---- assertEquals(locale.toString(), "ja_JP_#u-ca-japanese", "Unexpected locale"); Calendar cal = java.util.Calendar.getInstance(locale); assertEquals(cal.getCalendarType(), "japanese", "Unexpected calendar type"); ! JapaneseDate jDate = JapaneseChronology.INSTANCE.date(isoStartDate); // Convert to millis and set Japanese Calendar to that start date (at GMT) OffsetDateTime jodt = OffsetDateTime.of(isoStartDate, LocalTime.MIN, ZoneOffset.UTC); long millis = jodt.toInstant().toEpochMilli(); cal.setTimeZone(TimeZone.getTimeZone("GMT+00"));