Search in sources :

Example 16 with LocalTime

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

the class TCKLocalTime method test_toString.

@Test(dataProvider = "sampleToString")
public void test_toString(int h, int m, int s, int n, String expected) {
    LocalTime t = LocalTime.of(h, m, s, n);
    String str = t.toString();
    assertEquals(str, expected);
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 17 with LocalTime

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

the class TCKLocalTime method test_atOffset.

//-----------------------------------------------------------------------
// atOffset()
//-----------------------------------------------------------------------
@Test
public void test_atOffset() {
    LocalTime t = LocalTime.of(11, 30);
    assertEquals(t.atOffset(OFFSET_PTWO), OffsetTime.of(LocalTime.of(11, 30), OFFSET_PTWO));
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 18 with LocalTime

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

the class TCKLocalTime method test_plusHours_big.

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

Example 19 with LocalTime

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

the class TCKLocalTime method test_withNanoOfSecond_toMidday_equal.

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

Example 20 with LocalTime

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

the class TCKLocalTime method test_with_longTemporalField_hourOfAmPm.

// Returns a {@code LocalTime} with the specified hour-of-am-pm.
// The AM/PM, minute-of-hour, second-of-minute and nano-of-second will be unchanged.
@Test
public void test_with_longTemporalField_hourOfAmPm() {
    for (int i = 0; i < 12; i++) {
        LocalTime test = TEST_12_30_40_987654321.with(HOUR_OF_AMPM, i);
        assertEquals(test.get(HOUR_OF_AMPM), i);
        assertEquals(test.get(AMPM_OF_DAY), TEST_12_30_40_987654321.get(AMPM_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));
        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)213 Test (org.testng.annotations.Test)164 LocalDate (java.time.LocalDate)31 LocalDateTime (java.time.LocalDateTime)27 ZonedDateTime (java.time.ZonedDateTime)14 Test (org.junit.Test)14 Instant (java.time.Instant)11 Clock (java.time.Clock)8 OffsetDateTime (java.time.OffsetDateTime)8 TemporalAmount (java.time.temporal.TemporalAmount)8 DayOfWeek (java.time.DayOfWeek)7 DateTimeFormatter (java.time.format.DateTimeFormatter)7 Time (java.sql.Time)6 ZoneId (java.time.ZoneId)6 TemporalAccessor (java.time.temporal.TemporalAccessor)6 TimetableItem (de.hpi.bpt.scylla.model.global.resource.TimetableItem)5 OffsetTime (java.time.OffsetTime)5 Temporal (java.time.temporal.Temporal)5 Date (java.util.Date)5 Duration (java.time.Duration)4