Search in sources :

Example 16 with MinguoDate

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));
}
Also used : MinguoDate(java.time.chrono.MinguoDate) ChronoLocalDate(java.time.chrono.ChronoLocalDate) LocalDate(java.time.LocalDate) Test(org.testng.annotations.Test)

Example 17 with MinguoDate

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));
}
Also used : MinguoDate(java.time.chrono.MinguoDate) Test(org.testng.annotations.Test)

Example 18 with MinguoDate

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));
}
Also used : MinguoDate(java.time.chrono.MinguoDate) OffsetDateTime(java.time.OffsetDateTime) ZonedDateTime(java.time.ZonedDateTime) ChronoZonedDateTime(java.time.chrono.ChronoZonedDateTime) Test(org.testng.annotations.Test)

Example 19 with MinguoDate

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);
}
Also used : MinguoDate(java.time.chrono.MinguoDate) Test(org.testng.annotations.Test)

Example 20 with MinguoDate

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);
}
Also used : MinguoDate(java.time.chrono.MinguoDate) Test(org.testng.annotations.Test)

Aggregations

MinguoDate (java.time.chrono.MinguoDate)31 Test (org.testng.annotations.Test)29 TemporalField (java.time.temporal.TemporalField)10 HashMap (java.util.HashMap)10 DateTimeException (java.time.DateTimeException)7 ChronoPeriod (java.time.chrono.ChronoPeriod)5 DateTimeFormatter (java.time.format.DateTimeFormatter)5 DateTimeFormatterBuilder (java.time.format.DateTimeFormatterBuilder)3 TemporalAccessor (java.time.temporal.TemporalAccessor)3 ThaiBuddhistDate (java.time.chrono.ThaiBuddhistDate)2 LocalDate (java.time.LocalDate)1 LocalDateTime (java.time.LocalDateTime)1 OffsetDateTime (java.time.OffsetDateTime)1 ZoneOffset (java.time.ZoneOffset)1 ZonedDateTime (java.time.ZonedDateTime)1 ChronoLocalDate (java.time.chrono.ChronoLocalDate)1 ChronoLocalDateTime (java.time.chrono.ChronoLocalDateTime)1 ChronoZonedDateTime (java.time.chrono.ChronoZonedDateTime)1 JapaneseDate (java.time.chrono.JapaneseDate)1