use of java.time.chrono.ChronoPeriod in project jdk8u_jdk by JetBrains.
the class TCKChronoPeriod method test_multipliedBy.
@Test(dataProvider = "calendars")
public void test_multipliedBy(Chronology chrono) {
ChronoPeriod period = chrono.period(1, 2, 3);
assertEquals(period.multipliedBy(3), chrono.period(3, 6, 9));
}
use of java.time.chrono.ChronoPeriod in project jdk8u_jdk by JetBrains.
the class TCKChronoPeriod method test_plus.
//-----------------------------------------------------------------------
@Test(dataProvider = "calendars")
public void test_plus(Chronology chrono) {
ChronoPeriod period = chrono.period(1, 2, 3);
ChronoPeriod period2 = chrono.period(2, 3, 4);
ChronoPeriod result = period.plus(period2);
assertEquals(result, chrono.period(3, 5, 7));
}
use of java.time.chrono.ChronoPeriod 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);
}
use of java.time.chrono.ChronoPeriod 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));
}
use of java.time.chrono.ChronoPeriod in project jdk8u_jdk by JetBrains.
the class TCKJapaneseChronology method test_periodUntilDiffChrono.
@Test
public void test_periodUntilDiffChrono() {
JapaneseDate mdate1 = JapaneseDate.of(1970, 1, 1);
JapaneseDate mdate2 = JapaneseDate.of(1971, 2, 2);
MinguoDate ldate2 = MinguoChronology.INSTANCE.date(mdate2);
ChronoPeriod period = mdate1.until(ldate2);
assertEquals(period, JapaneseChronology.INSTANCE.period(1, 1, 1));
}
Aggregations