use of java.time.Period in project jdk8u_jdk by JetBrains.
the class TCKPeriod method test_plusDays_overflowTooBig.
@Test(expectedExceptions = ArithmeticException.class)
public void test_plusDays_overflowTooBig() {
Period test = Period.ofDays(Integer.MAX_VALUE);
test.plusDays(1);
}
use of java.time.Period in project jdk8u_jdk by JetBrains.
the class TCKPeriod method test_equals_self.
public void test_equals_self() {
Period test = Period.of(1, 2, 3);
assertEquals(test.equals(test), true);
}
use of java.time.Period in project jdk8u_jdk by JetBrains.
the class TCKPeriod method test_Period_getUnits.
//-----------------------------------------------------------------------
// get units
//-----------------------------------------------------------------------
@Test
public void test_Period_getUnits() {
Period period = Period.of(2012, 1, 1);
List<TemporalUnit> units = period.getUnits();
assertEquals(units.size(), 3, "Period.getUnits should return 3 units");
assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS");
assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS");
assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS");
}
use of java.time.Period in project jdk8u_jdk by JetBrains.
the class TCKPeriod method test_multipliedBy.
//-----------------------------------------------------------------------
// multipliedBy()
//-----------------------------------------------------------------------
@Test
public void test_multipliedBy() {
Period test = Period.of(1, 2, 3);
assertPeriod(test.multipliedBy(0), 0, 0, 0);
assertPeriod(test.multipliedBy(1), 1, 2, 3);
assertPeriod(test.multipliedBy(2), 2, 4, 6);
assertPeriod(test.multipliedBy(-3), -3, -6, -9);
}
use of java.time.Period in project jdk8u_jdk by JetBrains.
the class TCKPeriod method test_minusDays_overflowTooBig.
@Test(expectedExceptions = ArithmeticException.class)
public void test_minusDays_overflowTooBig() {
Period test = Period.ofDays(Integer.MAX_VALUE);
test.minusDays(-1);
}
Aggregations