Search in sources :

Example 51 with LocalTime

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

the class TCKLocalTime method test_minusNanos_noChange_equal.

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

Example 52 with LocalTime

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

the class TCKLocalTime method test_withHour_toMidnight_equal.

@Test
public void test_withHour_toMidnight_equal() {
    LocalTime t = LocalTime.of(1, 0).withHour(0);
    assertEquals(t, LocalTime.MIDNIGHT);
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 53 with LocalTime

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

the class TCKLocalTime method test_plusNanos_fromZero.

@Test(dataProvider = "plusNanos_fromZero")
public void test_plusNanos_fromZero(long nanoseconds, int hour, int min, int sec, int nanos) {
    LocalTime base = LocalTime.MIDNIGHT;
    LocalTime t = base.plusNanos(nanoseconds);
    assertEquals(hour, t.getHour());
    assertEquals(min, t.getMinute());
    assertEquals(sec, t.getSecond());
    assertEquals(nanos, t.getNano());
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 54 with LocalTime

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

the class TCKLocalTime method test_hashCode_nano_differs.

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

Example 55 with LocalTime

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

the class TCKLocalTime method test_with_longTemporalField_minuteOfDay.

// Returns a {@code LocalTime} with the specified minute-of-day.
// The second-of-minute and nano-of-second will be unchanged.
@Test
public void test_with_longTemporalField_minuteOfDay() {
    for (long i : testPoints(24 * 60)) {
        LocalTime test = TEST_12_30_40_987654321.with(MINUTE_OF_DAY, i);
        assertEquals(test.get(MINUTE_OF_DAY), i);
        assertEquals(test.get(SECOND_OF_MINUTE), TEST_12_30_40_987654321.get(SECOND_OF_MINUTE));
        assertEquals(test.get(NANO_OF_SECOND), TEST_12_30_40_987654321.get(NANO_OF_SECOND));
    }
}
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