Search in sources :

Example 11 with LocalTime

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

the class TCKLocalTime method test_hashCode_second_differs.

@Test(dataProvider = "sampleTimes")
public void test_hashCode_second_differs(int h, int m, int s, int n) {
    LocalTime a = LocalTime.of(h, m, s, n);
    LocalTime b = LocalTime.of(h, m, s + 1, n);
    assertEquals(a.hashCode() == b.hashCode(), false);
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 12 with LocalTime

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

the class TCKOffsetDateTime method factory_of_LocalDateLocalTimeZoneOffset.

//-----------------------------------------------------------------------
@Test
public void factory_of_LocalDateLocalTimeZoneOffset() {
    LocalDate date = LocalDate.of(2008, 6, 30);
    LocalTime time = LocalTime.of(11, 30, 10, 500);
    OffsetDateTime test = OffsetDateTime.of(date, time, OFFSET_PONE);
    check(test, 2008, 6, 30, 11, 30, 10, 500, OFFSET_PONE);
}
Also used : LocalTime(java.time.LocalTime) OffsetDateTime(java.time.OffsetDateTime) LocalDate(java.time.LocalDate) Test(org.testng.annotations.Test)

Example 13 with LocalTime

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

the class TCKLocalTime method test_plusHours_noChange_equal.

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

Example 14 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 15 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)

Aggregations

LocalTime (java.time.LocalTime)188 Test (org.testng.annotations.Test)164 LocalDate (java.time.LocalDate)21 LocalDateTime (java.time.LocalDateTime)20 Instant (java.time.Instant)11 Clock (java.time.Clock)8 TemporalAmount (java.time.temporal.TemporalAmount)8 Test (org.junit.Test)8 OffsetDateTime (java.time.OffsetDateTime)7 Time (java.sql.Time)6 OffsetTime (java.time.OffsetTime)5 DateTimeFormatter (java.time.format.DateTimeFormatter)5 ZonedDateTime (java.time.ZonedDateTime)4 ZoneId (java.time.ZoneId)3 TemporalAccessor (java.time.temporal.TemporalAccessor)3 BaseTest (util.BaseTest)3 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 ZoneOffset (java.time.ZoneOffset)2 ChronoZonedDateTime (java.time.chrono.ChronoZonedDateTime)2