use of java.time.Period in project j2objc by google.
the class TCKPeriod method test_plusMonths_overflowTooBig.
@Test(expected = ArithmeticException.class)
public void test_plusMonths_overflowTooBig() {
Period test = Period.ofMonths(Integer.MAX_VALUE);
test.plusMonths(1);
}
use of java.time.Period in project j2objc by google.
the class TCKPeriod method test_multipliedBy_overflowTooSmall.
@Test(expected = ArithmeticException.class)
public void test_multipliedBy_overflowTooSmall() {
Period test = Period.ofYears(Integer.MIN_VALUE / 2 - 1);
test.multipliedBy(2);
}
use of java.time.Period in project j2objc by google.
the class TCKPeriod method test_plusDays_overflowTooSmall.
@Test(expected = ArithmeticException.class)
public void test_plusDays_overflowTooSmall() {
Period test = Period.ofDays(Integer.MIN_VALUE);
test.plusDays(-1);
}
use of java.time.Period in project j2objc by google.
the class TCKPeriod method test_good_getUnit.
@Test()
@UseDataProvider("data_goodTemporalUnit")
public void test_good_getUnit(long amount, TemporalUnit unit) {
Period period = Period.of(2, 2, 2);
long actual = period.get(unit);
assertEquals("Value of unit: " + unit, actual, amount);
}
use of java.time.Period in project cayenne by apache.
the class Java8TimeIT method testJava8Period.
@Test
public void testJava8Period() {
PeriodTestEntity periodTestEntity = context.newObject(PeriodTestEntity.class);
Period period = Period.of(100, 10, 5);
periodTestEntity.setPeriodField(period);
context.commitChanges();
PeriodTestEntity testRead = ObjectSelect.query(PeriodTestEntity.class).selectOne(context);
assertNotNull(testRead.getPeriodField());
assertEquals(Period.class, testRead.getPeriodField().getClass());
assertEquals(period, testRead.getPeriodField());
}
Aggregations