use of java.time.chrono.ChronoPeriod in project jdk8u_jdk by JetBrains.
the class TCKChronoPeriod method test_get_unsupported.
@Test(dataProvider = "calendars", expectedExceptions = UnsupportedTemporalTypeException.class)
public void test_get_unsupported(Chronology chrono) {
ChronoPeriod period = chrono.period(1, 2, 3);
period.get(HOURS);
}
use of java.time.chrono.ChronoPeriod in project jdk8u_jdk by JetBrains.
the class TCKChronoPeriod method test_negated.
//-----------------------------------------------------------------------
@Test(dataProvider = "calendars")
public void test_negated(Chronology chrono) {
ChronoPeriod period = chrono.period(1, 2, 3);
assertEquals(period.negated(), chrono.period(-1, -2, -3));
}
use of java.time.chrono.ChronoPeriod in project jdk8u_jdk by JetBrains.
the class TCKChronoPeriod method test_addTo.
//-----------------------------------------------------------------------
@Test(dataProvider = "calendars")
public void test_addTo(Chronology chrono) {
ChronoPeriod period = chrono.period(1, 2, 3);
ChronoLocalDate date = chrono.dateNow();
Temporal result = period.addTo(date);
assertEquals(result, date.plus(14, MONTHS).plus(3, DAYS));
}
use of java.time.chrono.ChronoPeriod in project jdk8u_jdk by JetBrains.
the class TCKChronoPeriod method test_equals_notEqual.
@Test(dataProvider = "calendars")
public void test_equals_notEqual(Chronology chrono) {
ChronoPeriod a = chrono.period(1, 2, 3);
ChronoPeriod b = chrono.period(2, 2, 3);
assertEquals(a.equals(b), false);
assertEquals(b.equals(a), false);
assertEquals(a.equals(""), false);
assertEquals(a.equals(null), false);
}
use of java.time.chrono.ChronoPeriod in project jdk8u_jdk by JetBrains.
the class TCKChronoPeriod method test_subtractFrom.
@Test(dataProvider = "calendars")
public void test_subtractFrom(Chronology chrono) {
ChronoPeriod period = chrono.period(1, 2, 3);
ChronoLocalDate date = chrono.dateNow();
Temporal result = period.subtractFrom(date);
assertEquals(result, date.minus(14, MONTHS).minus(3, DAYS));
}
Aggregations