use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method plusNanos_long_overflowTooBig.
@Test(expectedExceptions = { ArithmeticException.class })
public void plusNanos_long_overflowTooBig() {
Duration t = Duration.ofSeconds(Long.MAX_VALUE, 999999999);
t.plusNanos(1);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method factory_nanos_min.
@Test
public void factory_nanos_min() {
Duration test = Duration.ofNanos(Long.MIN_VALUE);
assertEquals(test.getSeconds(), Long.MIN_VALUE / 1000000000 - 1);
assertEquals(test.getNano(), Long.MIN_VALUE % 1000000000 + 1000000000);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method plusMillis_long_overflowTooSmall.
@Test(expectedExceptions = { ArithmeticException.class })
public void plusMillis_long_overflowTooSmall() {
Duration t = Duration.ofSeconds(Long.MIN_VALUE, 0);
t.plusMillis(-1);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method plusMillis_long_max.
@Test
public void plusMillis_long_max() {
Duration t = Duration.ofSeconds(Long.MAX_VALUE, 998999999);
t = t.plusMillis(1);
assertEquals(t.getSeconds(), Long.MAX_VALUE);
assertEquals(t.getNano(), 999999999);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method plus_longTemporalUnit_seconds.
//-----------------------------------------------------------------------
@Test
public void plus_longTemporalUnit_seconds() {
Duration t = Duration.ofSeconds(1);
t = t.plus(1, SECONDS);
assertEquals(2, t.getSeconds());
assertEquals(0, t.getNano());
}
Aggregations