use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TCKMinguoChronology method test_LocalDate_adjustToMinguoDate.
//-----------------------------------------------------------------------
// LocalDate.with(MinguoDate)
//-----------------------------------------------------------------------
@Test
public void test_LocalDate_adjustToMinguoDate() {
MinguoDate minguo = MinguoChronology.INSTANCE.date(101, 10, 29);
LocalDate test = LocalDate.MIN.with(minguo);
assertEquals(test, LocalDate.of(2012, 10, 29));
}
use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TCKMinguoChronology method test_adjust2.
@Test
public void test_adjust2() {
MinguoDate base = MinguoChronology.INSTANCE.date(1728, 12, 2);
MinguoDate test = base.with(TemporalAdjusters.lastDayOfMonth());
assertEquals(test, MinguoChronology.INSTANCE.date(1728, 12, 31));
}
use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TCKMinguoChronology method test_Instant_zonedDateTime.
//-----------------------------------------------------------------------
// zonedDateTime(Instant, ZoneId )
//-----------------------------------------------------------------------
@Test
public void test_Instant_zonedDateTime() {
OffsetDateTime offsetDateTime = OffsetDateTime.of(2012, 2, 29, 2, 7, 1, 1, OFFSET_PTWO);
ZonedDateTime zonedDateTime = ZonedDateTime.of(2012, 2, 29, 2, 7, 1, 1, ZONE_PARIS);
ChronoZonedDateTime<MinguoDate> result = MinguoChronology.INSTANCE.zonedDateTime(offsetDateTime.toInstant(), offsetDateTime.getOffset());
assertEquals(result.toLocalDate(), MinguoChronology.INSTANCE.date(MinguoEra.ROC, 2012 - YDIFF, 2, 29));
assertEquals(result.toLocalTime(), LocalTime.of(2, 7, 1, 1));
result = MinguoChronology.INSTANCE.zonedDateTime(zonedDateTime.toInstant(), zonedDateTime.getOffset());
assertEquals(result.toLocalDate(), MinguoChronology.INSTANCE.date(MinguoEra.ROC, 2012 - YDIFF, 2, 29));
assertEquals(result.toLocalTime(), LocalTime.of(2, 7, 1, 1));
}
use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TCKMinguoChronology method test_MinguoChrono.
@Test()
public void test_MinguoChrono() {
MinguoDate h1 = MinguoChronology.INSTANCE.date(MinguoEra.ROC, 1, 2, 3);
MinguoDate h2 = h1;
ChronoLocalDateTime<MinguoDate> h3 = h2.atTime(LocalTime.NOON);
@SuppressWarnings("unused") ChronoZonedDateTime<MinguoDate> h4 = h3.atZone(ZoneOffset.UTC);
}
use of java.time.chrono.MinguoDate in project jdk8u_jdk by JetBrains.
the class TCKMinguoChronology method test_periodUntilUnit.
@Test
public void test_periodUntilUnit() {
MinguoDate mdate1 = MinguoDate.of(1970, 1, 1);
MinguoDate mdate2 = MinguoDate.of(1971, 2, 2);
long months = mdate1.until(mdate2, ChronoUnit.MONTHS);
assertEquals(months, 13);
}
Aggregations