use of java.time.chrono.ThaiBuddhistDate in project jdk8u_jdk by JetBrains.
the class TestThaiBuddhistChronoImpl method test_ThaiBuddhistChrono_vsCalendar.
//-----------------------------------------------------------------------
// Verify ThaiBuddhist Calendar matches java.util.Calendar for range
//-----------------------------------------------------------------------
@Test(dataProvider = "RangeVersusCalendar")
public void test_ThaiBuddhistChrono_vsCalendar(LocalDate isoStartDate, LocalDate isoEndDate) {
Locale locale = Locale.forLanguageTag("th-TH--u-ca-buddhist");
assertEquals(locale.toString(), "th_TH", "Unexpected locale");
Calendar cal = java.util.Calendar.getInstance(locale);
assertEquals(cal.getCalendarType(), "buddhist", "Unexpected calendar type");
ThaiBuddhistDate thaiDate = ThaiBuddhistChronology.INSTANCE.date(isoStartDate);
cal.setTimeZone(TimeZone.getTimeZone("GMT+00"));
cal.set(Calendar.YEAR, thaiDate.get(ChronoField.YEAR));
cal.set(Calendar.MONTH, thaiDate.get(ChronoField.MONTH_OF_YEAR) - 1);
cal.set(Calendar.DAY_OF_MONTH, thaiDate.get(ChronoField.DAY_OF_MONTH));
while (thaiDate.isBefore(isoEndDate)) {
assertEquals(thaiDate.get(ChronoField.DAY_OF_MONTH), cal.get(Calendar.DAY_OF_MONTH), "Day mismatch in " + thaiDate + "; cal: " + cal);
assertEquals(thaiDate.get(ChronoField.MONTH_OF_YEAR), cal.get(Calendar.MONTH) + 1, "Month mismatch in " + thaiDate);
assertEquals(thaiDate.get(ChronoField.YEAR_OF_ERA), cal.get(Calendar.YEAR), "Year mismatch in " + thaiDate);
thaiDate = thaiDate.plus(1, ChronoUnit.DAYS);
cal.add(Calendar.DAY_OF_MONTH, 1);
}
}
use of java.time.chrono.ThaiBuddhistDate in project jdk8u_jdk by JetBrains.
the class TestChronoLocalDate method test_date_checkGenerics_genericsMethod_concreteType.
public void test_date_checkGenerics_genericsMethod_concreteType() {
ThaiBuddhistChronology chrono = ThaiBuddhistChronology.INSTANCE;
ThaiBuddhistDate date = chrono.dateNow();
date = ThaiBuddhistDate.now();
date = processOK(date);
date = processClassOK(ThaiBuddhistDate.class);
date = dateSupplier();
// date = processClassWeird(ThaiBuddhistDate.class); // does not compile (correct)
}
Aggregations