use of java.time.chrono.ChronoLocalDate in project jdk8u_jdk by JetBrains.
the class TCKChronology method test_MinguoChronology_dateYearDay.
@Test
public void test_MinguoChronology_dateYearDay() {
Chronology chrono = Chronology.of("Minguo");
ChronoLocalDate date1 = chrono.dateYearDay(MinguoEra.ROC, 5, 60);
ChronoLocalDate date2 = chrono.date(MinguoEra.ROC, 5, 2, 29);
assertEquals(date1, MinguoChronology.INSTANCE.dateYearDay(MinguoEra.ROC, 5, 60));
assertEquals(date2, MinguoChronology.INSTANCE.dateYearDay(MinguoEra.ROC, 5, 60));
}
use of java.time.chrono.ChronoLocalDate in project jdk8u_jdk by JetBrains.
the class TCKChronoPeriod method test_addTo_wrongChrono.
@Test(dataProvider = "calendars", expectedExceptions = DateTimeException.class)
public void test_addTo_wrongChrono(Chronology chrono) {
ChronoPeriod period = chrono.period(1, 2, 3);
ChronoLocalDate isoDate = LocalDate.of(2000, 1, 1);
ChronoLocalDate thaiDate = ThaiBuddhistChronology.INSTANCE.date(2000, 1, 1);
// one of these two will fail
period.addTo(isoDate);
period.addTo(thaiDate);
}
use of java.time.chrono.ChronoLocalDate in project jdk8u_jdk by JetBrains.
the class TCKChronology method test_ThaiBuddhistChronology_dateYearDay.
@Test
public void test_ThaiBuddhistChronology_dateYearDay() {
Chronology chrono = Chronology.of("ThaiBuddhist");
ChronoLocalDate date1 = chrono.dateYearDay(ThaiBuddhistEra.BE, 2459, 60);
ChronoLocalDate date2 = chrono.date(ThaiBuddhistEra.BE, 2459, 2, 29);
assertEquals(date1, ThaiBuddhistChronology.INSTANCE.dateYearDay(ThaiBuddhistEra.BE, 2459, 60));
assertEquals(date2, ThaiBuddhistChronology.INSTANCE.dateYearDay(ThaiBuddhistEra.BE, 2459, 60));
}
use of java.time.chrono.ChronoLocalDate in project jdk8u_jdk by JetBrains.
the class TCKChronology method test_epoch.
/**
* Compute the number of days from the Epoch and compute the date from the number of days.
*/
@Test(dataProvider = "calendarNameAndType")
public void test_epoch(String name, String alias) {
// a chronology. In practice this is rarely hardcoded
Chronology chrono = Chronology.of(name);
ChronoLocalDate date1 = chrono.dateNow();
long epoch1 = date1.getLong(ChronoField.EPOCH_DAY);
ChronoLocalDate date2 = date1.with(ChronoField.EPOCH_DAY, epoch1);
assertEquals(date1, date2, "Date from epoch day is not same date: " + date1 + " != " + date2);
long epoch2 = date1.getLong(ChronoField.EPOCH_DAY);
assertEquals(epoch1, epoch2, "Epoch day not the same: " + epoch1 + " != " + epoch2);
}
use of java.time.chrono.ChronoLocalDate in project jdk8u_jdk by JetBrains.
the class TCKChronoPeriod method test_subtractFrom_wrongChrono.
@Test(dataProvider = "calendars", expectedExceptions = DateTimeException.class)
public void test_subtractFrom_wrongChrono(Chronology chrono) {
ChronoPeriod period = chrono.period(1, 2, 3);
ChronoLocalDate isoDate = LocalDate.of(2000, 1, 1);
ChronoLocalDate thaiDate = ThaiBuddhistChronology.INSTANCE.date(2000, 1, 1);
// one of these two will fail
period.subtractFrom(isoDate);
period.subtractFrom(thaiDate);
}
Aggregations