Search in sources :

Example 61 with LocalTime

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

the class TCKLocalTime method test_plusHours_toMidday_equal.

@Test
public void test_plusHours_toMidday_equal() {
    LocalTime t = LocalTime.of(11, 0).plusHours(1);
    assertEquals(t, LocalTime.NOON);
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 62 with LocalTime

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

the class TCKLocalTime method now_Clock_min.

@Test
public void now_Clock_min() {
    Clock clock = Clock.fixed(Instant.MIN, ZoneOffset.UTC);
    LocalTime test = LocalTime.now(clock);
    assertEquals(test.getHour(), 0);
    assertEquals(test.getMinute(), 0);
    assertEquals(test.getSecond(), 0);
    assertEquals(test.getNano(), 0);
}
Also used : LocalTime(java.time.LocalTime) Clock(java.time.Clock) Test(org.testng.annotations.Test)

Example 63 with LocalTime

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

the class TCKLocalTime method test_plusNanos_noChange_equal.

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

Example 64 with LocalTime

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

the class TCKLocalTime method test_with_longTemporalField_microOfSecond.

// Returns a {@code LocalTime} with the nano-of-second replaced by the specified
// micro-of-second multiplied by 1,000.
// The hour, minute and second will be unchanged.
@Test
public void test_with_longTemporalField_microOfSecond() {
    for (long i : testPoints(1_000_000L)) {
        LocalTime test = TEST_12_30_40_987654321.with(MICRO_OF_SECOND, i);
        assertEquals(test.get(NANO_OF_SECOND), i * 1_000);
        assertEquals(test.get(HOUR_OF_DAY), TEST_12_30_40_987654321.get(HOUR_OF_DAY));
        assertEquals(test.get(MINUTE_OF_HOUR), TEST_12_30_40_987654321.get(MINUTE_OF_HOUR));
        assertEquals(test.get(SECOND_OF_MINUTE), TEST_12_30_40_987654321.get(SECOND_OF_MINUTE));
    }
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 65 with LocalTime

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

the class TCKLocalTime method test_withNanoOfSecond_noChange_equal.

@Test
public void test_withNanoOfSecond_noChange_equal() {
    LocalTime t = TEST_12_30_40_987654321.withNano(987654321);
    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