Search in sources :

Example 36 with LocalTime

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

the class TCKLocalTime method test_plusHours_toMidnight_equal.

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

Example 37 with LocalTime

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

the class TCKLocalTime method test_minusHours_noChange_equal.

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

Example 38 with LocalTime

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

the class TCKLocalTime method test_minusHours_fromZero.

@Test
public void test_minusHours_fromZero() {
    LocalTime base = LocalTime.MIDNIGHT;
    for (int i = -50; i < 50; i++) {
        LocalTime t = base.minusHours(i);
        assertEquals(t.getHour(), ((-i % 24) + 24) % 24);
    }
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 39 with LocalTime

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

the class TCKLocalTime method test_plusHours_fromOne.

@Test
public void test_plusHours_fromOne() {
    LocalTime base = LocalTime.of(1, 0);
    for (int i = -50; i < 50; i++) {
        LocalTime t = base.plusHours(i);
        assertEquals(t.getHour(), (1 + i + 72) % 24);
    }
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 40 with LocalTime

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

the class TCKLocalTime method test_minusHours_one.

//-----------------------------------------------------------------------
// minusHours()
//-----------------------------------------------------------------------
@Test
public void test_minusHours_one() {
    LocalTime t = LocalTime.MIDNIGHT;
    for (int i = 0; i < 50; i++) {
        t = t.minusHours(1);
        assertEquals(t.getHour(), (((-i + 23) % 24) + 24) % 24, String.valueOf(i));
    }
}
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