Search in sources :

Example 41 with Duration

use of java.time.Duration in project jdk8u_jdk by JetBrains.

the class TestDuration method minusNanos_zeroReturnsThis.

@Test
public void minusNanos_zeroReturnsThis() {
    Duration t = Duration.ofSeconds(1, 2000000);
    assertSame(t.minusNanos(0), t);
}
Also used : Duration(java.time.Duration) Test(org.testng.annotations.Test)

Example 42 with Duration

use of java.time.Duration in project jdk8u_jdk by JetBrains.

the class TestDuration method minus_zeroSingleton.

@Test
public void minus_zeroSingleton() {
    Duration t = Duration.ofSeconds(1);
    assertSame(t.minus(Duration.ofSeconds(1)), Duration.ZERO);
}
Also used : Duration(java.time.Duration) Test(org.testng.annotations.Test)

Example 43 with Duration

use of java.time.Duration in project jdk8u_jdk by JetBrains.

the class TestDuration method minus_zeroReturnsThis.

@Test
public void minus_zeroReturnsThis() {
    Duration t = Duration.ofSeconds(1);
    assertSame(t.minus(Duration.ZERO), t);
}
Also used : Duration(java.time.Duration) Test(org.testng.annotations.Test)

Example 44 with Duration

use of java.time.Duration in project jdk8u_jdk by JetBrains.

the class TestDuration method plusMillis_zeroReturnsThis.

@Test
public void plusMillis_zeroReturnsThis() {
    Duration t = Duration.ofSeconds(-1, 2000000);
    assertSame(t.plusMillis(0), t);
}
Also used : Duration(java.time.Duration) Test(org.testng.annotations.Test)

Example 45 with Duration

use of java.time.Duration in project jdk8u_jdk by JetBrains.

the class TCKDuration method multipliedBy_tooBig.

@Test(expectedExceptions = ArithmeticException.class)
public void multipliedBy_tooBig() {
    Duration test = Duration.ofSeconds(1, 1);
    test.multipliedBy(Long.MAX_VALUE);
}
Also used : Duration(java.time.Duration) Test(org.testng.annotations.Test)

Aggregations

Duration (java.time.Duration)1205 Test (org.junit.Test)418 Test (org.testng.annotations.Test)139 Instant (java.time.Instant)128 Test (org.junit.jupiter.api.Test)83 List (java.util.List)82 ArrayList (java.util.ArrayList)81 CompletableFuture (java.util.concurrent.CompletableFuture)81 Collectors (java.util.stream.Collectors)73 Collections (java.util.Collections)62 Preconditions (com.google.common.base.Preconditions)61 Map (java.util.Map)60 Slf4j (lombok.extern.slf4j.Slf4j)59 lombok.val (lombok.val)55 HashMap (java.util.HashMap)54 Arrays (java.util.Arrays)52 Function (java.util.function.Function)51 IOException (java.io.IOException)49 HashSet (java.util.HashSet)47 TimeUnit (java.util.concurrent.TimeUnit)47