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());
}
use of java.time.Duration in project jdk8u_jdk by JetBrains.
the class TCKOffsetDateTime method test_plus_Duration.
//-----------------------------------------------------------------------
// plus(Duration)
//-----------------------------------------------------------------------
@Test
public void test_plus_Duration() {
Duration dur = Duration.ofSeconds(62, 3);
OffsetDateTime t = TEST_2008_6_30_11_30_59_000000500.plus(dur);
assertEquals(t, OffsetDateTime.of(2008, 6, 30, 11, 32, 1, 503, OFFSET_PONE));
}
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