Search in sources :

Example 26 with ThaiBuddhistDate

use of java.time.chrono.ThaiBuddhistDate in project jdk8u_jdk by JetBrains.

the class TCKThaiBuddhistChronology method test_withYear_BE.

//-----------------------------------------------------------------------
// withYear()
//-----------------------------------------------------------------------
@Test
public void test_withYear_BE() {
    ThaiBuddhistDate base = ThaiBuddhistChronology.INSTANCE.date(2555, 8, 29);
    ThaiBuddhistDate test = base.with(YEAR, 2554);
    assertEquals(test, ThaiBuddhistChronology.INSTANCE.date(2554, 8, 29));
}
Also used : ThaiBuddhistDate(java.time.chrono.ThaiBuddhistDate) Test(org.testng.annotations.Test)

Example 27 with ThaiBuddhistDate

use of java.time.chrono.ThaiBuddhistDate in project jdk8u_jdk by JetBrains.

the class TCKThaiBuddhistChronology method test_resolve_ymaa_lenient.

@Test(dataProvider = "resolve_ymaa")
public void test_resolve_ymaa_lenient(int y, int m, int w, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) {
    Map<TemporalField, Long> fieldValues = new HashMap<>();
    fieldValues.put(ChronoField.YEAR, (long) y);
    fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
    fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w);
    fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d);
    ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
    assertEquals(date, expected);
    assertEquals(fieldValues.size(), 0);
}
Also used : ThaiBuddhistDate(java.time.chrono.ThaiBuddhistDate) TemporalField(java.time.temporal.TemporalField) HashMap(java.util.HashMap) Test(org.testng.annotations.Test)

Example 28 with ThaiBuddhistDate

use of java.time.chrono.ThaiBuddhistDate in project jdk8u_jdk by JetBrains.

the class TCKThaiBuddhistChronology method test_withEra_swap.

@Test
public void test_withEra_swap() {
    ThaiBuddhistDate base = ThaiBuddhistChronology.INSTANCE.date(-2554, 8, 29);
    ThaiBuddhistDate test = base.with(ChronoField.ERA, ThaiBuddhistEra.BE.getValue());
    assertEquals(test, ThaiBuddhistChronology.INSTANCE.date(2555, 8, 29));
}
Also used : ThaiBuddhistDate(java.time.chrono.ThaiBuddhistDate) Test(org.testng.annotations.Test)

Example 29 with ThaiBuddhistDate

use of java.time.chrono.ThaiBuddhistDate in project jdk8u_jdk by JetBrains.

the class TCKMinguoChronology method test_periodUntilDiffChrono.

@Test
public void test_periodUntilDiffChrono() {
    MinguoDate mdate1 = MinguoDate.of(1970, 1, 1);
    MinguoDate mdate2 = MinguoDate.of(1971, 2, 2);
    ThaiBuddhistDate ldate2 = ThaiBuddhistChronology.INSTANCE.date(mdate2);
    ChronoPeriod period = mdate1.until(ldate2);
    assertEquals(period, MinguoChronology.INSTANCE.period(1, 1, 1));
}
Also used : ChronoPeriod(java.time.chrono.ChronoPeriod) MinguoDate(java.time.chrono.MinguoDate) ThaiBuddhistDate(java.time.chrono.ThaiBuddhistDate) Test(org.testng.annotations.Test)

Example 30 with ThaiBuddhistDate

use of java.time.chrono.ThaiBuddhistDate in project jdk8u_jdk by JetBrains.

the class TCKThaiBuddhistChronology method test_withYear_BBE.

@Test
public void test_withYear_BBE() {
    ThaiBuddhistDate base = ThaiBuddhistChronology.INSTANCE.date(-2554, 8, 29);
    ThaiBuddhistDate test = base.with(YEAR_OF_ERA, 2554);
    assertEquals(test, ThaiBuddhistChronology.INSTANCE.date(-2553, 8, 29));
}
Also used : ThaiBuddhistDate(java.time.chrono.ThaiBuddhistDate) Test(org.testng.annotations.Test)

Aggregations

ThaiBuddhistDate (java.time.chrono.ThaiBuddhistDate)32 Test (org.testng.annotations.Test)29 TemporalField (java.time.temporal.TemporalField)10 HashMap (java.util.HashMap)10 DateTimeException (java.time.DateTimeException)7 LocalDateTime (java.time.LocalDateTime)3 ChronoPeriod (java.time.chrono.ChronoPeriod)3 MinguoDate (java.time.chrono.MinguoDate)3 LocalDate (java.time.LocalDate)2 ChronoLocalDate (java.time.chrono.ChronoLocalDate)2 DateTimeFormatterBuilder (java.time.format.DateTimeFormatterBuilder)2 ParsePosition (java.text.ParsePosition)1 Clock (java.time.Clock)1 Instant (java.time.Instant)1 LocalTime (java.time.LocalTime)1 OffsetDateTime (java.time.OffsetDateTime)1 OffsetTime (java.time.OffsetTime)1 YearMonth (java.time.YearMonth)1 ZonedDateTime (java.time.ZonedDateTime)1 ChronoZonedDateTime (java.time.chrono.ChronoZonedDateTime)1