use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method factory_parse.
@Test(dataProvider = "parseSuccess")
public void factory_parse(String text, long expectedSeconds, int expectedNanoOfSecond) {
Duration test = Duration.parse(text);
assertEquals(test.getSeconds(), expectedSeconds);
assertEquals(test.getNano(), expectedNanoOfSecond);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method minusNanos_long_overflowTooSmall.
@Test(expectedExceptions = { ArithmeticException.class })
public void minusNanos_long_overflowTooSmall() {
Duration t = Duration.ofSeconds(Long.MIN_VALUE, 0);
t.minusNanos(1);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method minusMillis_long_overflowTooSmall.
@Test(expectedExceptions = { ArithmeticException.class })
public void minusMillis_long_overflowTooSmall() {
Duration t = Duration.ofSeconds(Long.MIN_VALUE, 0);
t.minusMillis(1);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method test_toString.
@Test(dataProvider = "toString")
public void test_toString(long seconds, int nanos, String expected) {
Duration t = Duration.ofSeconds(seconds, nanos);
assertEquals(t.toString(), expected);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method test_toMillis_tooBig.
@Test(expectedExceptions = ArithmeticException.class)
public void test_toMillis_tooBig() {
Duration test = Duration.ofSeconds(Long.MAX_VALUE / 1000, ((Long.MAX_VALUE % 1000) + 1) * 1000000);
test.toMillis();
}
Aggregations