use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method minusMillis_long_oneMore.
@Test(dataProvider = "MinusMillis")
public void minusMillis_long_oneMore(long seconds, int nanos, long amount, long expectedSeconds, int expectedNanoOfSecond) {
Duration t = Duration.ofSeconds(seconds + 1, nanos);
t = t.minusMillis(amount);
assertEquals(t.getSeconds(), expectedSeconds + 1);
assertEquals(t.getNano(), expectedNanoOfSecond);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method test_equals_otherClass.
@Test
public void test_equals_otherClass() {
Duration test5 = Duration.ofSeconds(5L, 20);
assertEquals(test5.equals(""), false);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKDuration method minusMillis_long_minusOneLess.
@Test(dataProvider = "MinusMillis")
public void minusMillis_long_minusOneLess(long seconds, int nanos, long amount, long expectedSeconds, int expectedNanoOfSecond) {
Duration t = Duration.ofSeconds(seconds - 1, nanos);
t = t.minusMillis(amount);
assertEquals(t.getSeconds(), expectedSeconds - 1);
assertEquals(t.getNano(), expectedNanoOfSecond);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKZonedDateTime method test_minus_TemporalAmount_Duration.
@Test
public void test_minus_TemporalAmount_Duration() {
Duration duration = Duration.ofSeconds(4L * 60 * 60 + 5L * 60 + 6L);
ZonedDateTime t = ZonedDateTime.of(LocalDateTime.of(2008, 6, 1, 12, 30, 59, 500), ZONE_0100);
ZonedDateTime expected = ZonedDateTime.of(LocalDateTime.of(2008, 6, 1, 8, 25, 53, 500), ZONE_0100);
assertEquals(t.minus(duration), expected);
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TestDuration method plusNanos_zeroReturnsThis.
@Test
public void plusNanos_zeroReturnsThis() {
Duration t = Duration.ofSeconds(-1, 2000000);
assertSame(t.plusNanos(0), t);
}
Aggregations