Search in sources :

Example 76 with LocalTime

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

the class TCKLocalTime method test_toNanoOfDay_fromNanoOfDay_symmetry.

@Test
public void test_toNanoOfDay_fromNanoOfDay_symmetry() {
    LocalTime t = LocalTime.of(0, 0);
    for (int i = 0; i < 1000000; i++) {
        assertEquals(LocalTime.ofNanoOfDay(t.toNanoOfDay()), t);
        t = t.plusNanos(1);
    }
    t = LocalTime.of(0, 0);
    for (int i = 1; i <= 1000000; i++) {
        t = t.minusNanos(1);
        assertEquals(LocalTime.ofNanoOfDay(t.toNanoOfDay()), t);
    }
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 77 with LocalTime

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

the class TCKLocalTime method test_minusMinutes_big.

@Test
public void test_minusMinutes_big() {
    LocalTime t = LocalTime.of(2, 30).minusMinutes(Long.MAX_VALUE);
    int mins = (int) (Long.MAX_VALUE % (24L * 60L));
    assertEquals(t, LocalTime.of(2, 30).minusMinutes(mins));
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 78 with LocalTime

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

the class TCKLocalTime method test_minusSeconds_noChange_equal.

@Test
public void test_minusSeconds_noChange_equal() {
    LocalTime t = TEST_12_30_40_987654321.minusSeconds(0);
    assertEquals(t, TEST_12_30_40_987654321);
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 79 with LocalTime

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

the class TCKLocalTime method test_withSecond_normal.

//-----------------------------------------------------------------------
// withSecond()
//-----------------------------------------------------------------------
@Test
public void test_withSecond_normal() {
    LocalTime t = TEST_12_30_40_987654321;
    for (int i = 0; i < 60; i++) {
        t = t.withSecond(i);
        assertEquals(t.getSecond(), i);
    }
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 80 with LocalTime

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

the class TCKLocalTime method test_withHour_noChange_equal.

@Test
public void test_withHour_noChange_equal() {
    LocalTime t = TEST_12_30_40_987654321.withHour(12);
    assertEquals(t, TEST_12_30_40_987654321);
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Aggregations

LocalTime (java.time.LocalTime)676 Test (org.junit.Test)262 Test (org.testng.annotations.Test)173 LocalDate (java.time.LocalDate)156 LocalDateTime (java.time.LocalDateTime)130 ZonedDateTime (java.time.ZonedDateTime)36 Date (java.util.Date)32 Instant (java.time.Instant)30 OffsetDateTime (java.time.OffsetDateTime)30 DateTimeFormatter (java.time.format.DateTimeFormatter)27 Test (org.junit.jupiter.api.Test)27 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)23 ZoneOffset (java.time.ZoneOffset)23 ZoneId (java.time.ZoneId)22 ArrayList (java.util.ArrayList)19 BigDecimal (java.math.BigDecimal)18 TemporalAccessor (java.time.temporal.TemporalAccessor)18 TemporalAmount (java.time.temporal.TemporalAmount)18 Time (java.sql.Time)17 Clock (java.time.Clock)17