Search in sources :

Example 66 with LocalTime

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

the class TCKLocalTime method test_plus_longTemporalUnit_positiveHours.

//-----------------------------------------------------------------------
// plus(long,TemporalUnit)
//-----------------------------------------------------------------------
@Test
public void test_plus_longTemporalUnit_positiveHours() {
    LocalTime t = TEST_12_30_40_987654321.plus(7, ChronoUnit.HOURS);
    assertEquals(t, LocalTime.of(19, 30, 40, 987654321));
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 67 with LocalTime

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

the class TCKLocalTime method factory_parse_validText.

//-----------------------------------------------------------------------
// parse()
//-----------------------------------------------------------------------
@Test(dataProvider = "sampleToString")
public void factory_parse_validText(int h, int m, int s, int n, String parsable) {
    LocalTime t = LocalTime.parse(parsable);
    assertNotNull(t, parsable);
    assertEquals(t.getHour(), h);
    assertEquals(t.getMinute(), m);
    assertEquals(t.getSecond(), s);
    assertEquals(t.getNano(), n);
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 68 with LocalTime

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

the class TCKLocalTime method test_plusSeconds_noChange_oneDay_equal.

@Test
public void test_plusSeconds_noChange_oneDay_equal() {
    LocalTime t = TEST_12_30_40_987654321.plusSeconds(24 * 60 * 60);
    assertEquals(t, TEST_12_30_40_987654321);
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 69 with LocalTime

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

the class TCKLocalTime method test_minus_longTemporalUnit_positiveHours.

//-----------------------------------------------------------------------
// minus(long,TemporalUnit)
//-----------------------------------------------------------------------
@Test
public void test_minus_longTemporalUnit_positiveHours() {
    LocalTime t = TEST_12_30_40_987654321.minus(7, ChronoUnit.HOURS);
    assertEquals(t, LocalTime.of(5, 30, 40, 987654321));
}
Also used : LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 70 with LocalTime

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

the class TCKLocalTime method test_minusNanos_toMidday_equal.

@Test
public void test_minusNanos_toMidday_equal() {
    LocalTime t = LocalTime.of(12, 0, 0, 1).minusNanos(1);
    assertEquals(t, LocalTime.NOON);
}
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