use of java.time.chrono.ChronoPeriod in project j2objc by google.
the class TCKChronoPeriod method test_get.
@Test()
@UseDataProvider("data_of_calendars")
public void test_get(Chronology chrono) {
ChronoPeriod period = chrono.period(1, 2, 3);
assertEquals(period.get(YEARS), 1);
assertEquals(period.get(MONTHS), 2);
assertEquals(period.get(DAYS), 3);
}
use of java.time.chrono.ChronoPeriod in project j2objc by google.
the class TCKChronoPeriod method test_multipliedBy.
@Test()
@UseDataProvider("data_of_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 j2objc by google.
the class TCKChronoPeriod method test_equals_notEqual.
@Test()
@UseDataProvider("data_of_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 j2objc by google.
the class TCKChronoPeriod method test_subtractFrom.
/* J2ObjC removed: Only "gregorian" and "julian" calendars are supported.
@Test(expected=DateTimeException.class)
@UseDataProvider("data_of_calendars")
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);
} */
@Test()
@UseDataProvider("data_of_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));
}
use of java.time.chrono.ChronoPeriod in project j2objc by google.
the class TCKChronoPeriod method test_get_unsupported.
@Test(expected = UnsupportedTemporalTypeException.class)
@UseDataProvider("data_of_calendars")
public void test_get_unsupported(Chronology chrono) {
ChronoPeriod period = chrono.period(1, 2, 3);
period.get(HOURS);
}
Aggregations