Search in sources :

Example 86 with Duration

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);
}
Also used : Duration(java.time.Duration) Test(org.testng.annotations.Test)

Example 87 with Duration

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);
}
Also used : Duration(java.time.Duration) Test(org.testng.annotations.Test)

Example 88 with Duration

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);
}
Also used : Duration(java.time.Duration) Test(org.testng.annotations.Test)

Example 89 with Duration

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);
}
Also used : Duration(java.time.Duration) Test(org.testng.annotations.Test)

Example 90 with Duration

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());
}
Also used : Duration(java.time.Duration) Test(org.testng.annotations.Test)

Aggregations

Duration (java.time.Duration)195 Test (org.testng.annotations.Test)135 Instant (java.time.Instant)17 Test (org.junit.Test)16 List (java.util.List)6 Map (java.util.Map)4 ZonedDateTime (java.time.ZonedDateTime)3 ArrayList (java.util.ArrayList)3 ImmutableMap (com.google.common.collect.ImmutableMap)2 ReplSetHeartbeatReply (com.torodb.mongodb.commands.signatures.internal.ReplSetHeartbeatReply)2 LocalDateTime (java.time.LocalDateTime)2 OffsetDateTime (java.time.OffsetDateTime)2 ZoneId (java.time.ZoneId)2 DateTimeFormatter (java.time.format.DateTimeFormatter)2 Iterator (java.util.Iterator)2 Optional (java.util.Optional)2 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 Collectors (java.util.stream.Collectors)2 Edge (org.apache.tinkerpop.gremlin.structure.Edge)2 JSONLexer (com.alibaba.fastjson.parser.JSONLexer)1