use of java.time.chrono.ChronoPeriod in project jdk8u_jdk by JetBrains.
the class TestUmmAlQuraChronology method test_periodUntilDiffChrono.
// Test to get the Period between dates in different chronologies
@Test(dataProvider = "datesForPeriod")
public void test_periodUntilDiffChrono(HijrahDate h1, HijrahDate h2, ChronoPeriod p) {
MinguoDate m = MinguoChronology.INSTANCE.date(h2);
ChronoPeriod period = h1.until(m);
assertEquals(period, p);
}
use of java.time.chrono.ChronoPeriod in project jdk8u_jdk by JetBrains.
the class TCKThaiBuddhistChronology method test_periodUntilDiffChrono.
@Test
public void test_periodUntilDiffChrono() {
ThaiBuddhistDate mdate1 = ThaiBuddhistDate.of(1, 1, 1);
ThaiBuddhistDate mdate2 = ThaiBuddhistDate.of(2, 2, 2);
MinguoDate ldate2 = MinguoChronology.INSTANCE.date(mdate2);
ChronoPeriod period = mdate1.until(ldate2);
assertEquals(period, ThaiBuddhistChronology.INSTANCE.period(1, 1, 1));
}
use of java.time.chrono.ChronoPeriod in project jdk8u_jdk by JetBrains.
the class TCKChronoPeriod method test_minus_wrongChrono.
@Test(dataProvider = "calendars", expectedExceptions = DateTimeException.class)
public void test_minus_wrongChrono(Chronology chrono) {
ChronoPeriod period = chrono.period(1, 2, 3);
ChronoPeriod isoPeriod = Period.of(2, 3, 4);
ChronoPeriod thaiPeriod = ThaiBuddhistChronology.INSTANCE.period(2, 3, 4);
// one of these two will fail
period.minus(isoPeriod);
period.minus(thaiPeriod);
}
use of java.time.chrono.ChronoPeriod in project jdk8u_jdk by JetBrains.
the class TCKChronoPeriod method test_getChronology.
@Test(dataProvider = "calendars")
public void test_getChronology(Chronology chrono) {
ChronoPeriod period = chrono.period(1, 2, 3);
assertEquals(period.getChronology(), chrono);
}
use of java.time.chrono.ChronoPeriod in project jdk8u_jdk by JetBrains.
the class TCKChronoPeriod method test_getUnits.
@Test(dataProvider = "calendars")
public void test_getUnits(Chronology chrono) {
ChronoPeriod period = chrono.period(1, 2, 3);
assertEquals(period.getUnits().size(), 3);
assertEquals(period.getUnits().get(0), YEARS);
assertEquals(period.getUnits().get(1), MONTHS);
assertEquals(period.getUnits().get(2), DAYS);
}
Aggregations