use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method multipliedBy_tooBig.
@Test(expectedExceptions = ArithmeticException.class)
public void multipliedBy_tooBig() {
Duration test = Duration.ofSeconds(1, 1);
test.multipliedBy(Long.MAX_VALUE);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method plus_longTemporalUnit_micros.
@Test
public void plus_longTemporalUnit_micros() {
Duration t = Duration.ofSeconds(1);
t = t.plus(1, MICROS);
assertEquals(1, t.getSeconds());
assertEquals(1000, t.getNano());
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method minusSeconds_long_overflowTooSmall.
@Test(expectedExceptions = { ArithmeticException.class })
public void minusSeconds_long_overflowTooSmall() {
Duration t = Duration.ofSeconds(-2, 0);
t.minusSeconds(Long.MAX_VALUE);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method factory_of_longTemporalUnit.
@Test(dataProvider = "OfTemporalUnit")
public void factory_of_longTemporalUnit(long amount, TemporalUnit unit, long expectedSeconds, int expectedNanoOfSecond) {
Duration t = Duration.of(amount, unit);
assertEquals(t.getSeconds(), expectedSeconds);
assertEquals(t.getNano(), expectedNanoOfSecond);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method test_toMillis_max.
@Test
public void test_toMillis_max() {
Duration test = Duration.ofSeconds(Long.MAX_VALUE / 1000, (Long.MAX_VALUE % 1000) * 1000000);
assertEquals(test.toMillis(), Long.MAX_VALUE);
}
Aggregations