Search in sources :

Example 26 with OffsetTime

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

the class TCKOffsetTime method factory_ofInstant_beforeEpoch.

@Test
public void factory_ofInstant_beforeEpoch() {
    for (int i = -1; i >= -(24 * 60 * 60); i--) {
        Instant instant = Instant.ofEpochSecond(i, 8);
        OffsetTime test = OffsetTime.ofInstant(instant, ZoneOffset.UTC);
        assertEquals(test.getHour(), ((i + 24 * 60 * 60) / (60 * 60)) % 24);
        assertEquals(test.getMinute(), ((i + 24 * 60 * 60) / 60) % 60);
        assertEquals(test.getSecond(), (i + 24 * 60 * 60) % 60);
        assertEquals(test.getNano(), 8);
    }
}
Also used : OffsetTime(java.time.OffsetTime) Instant(java.time.Instant) Test(org.testng.annotations.Test)

Example 27 with OffsetTime

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

the class TCKOffsetTime method test_plusSeconds.

//-----------------------------------------------------------------------
// plusSeconds()
//-----------------------------------------------------------------------
@Test
public void test_plusSeconds() {
    OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE);
    OffsetTime test = base.plusSeconds(1);
    assertEquals(test, OffsetTime.of(11, 31, 0, 0, OFFSET_PONE));
}
Also used : OffsetTime(java.time.OffsetTime) Test(org.testng.annotations.Test)

Example 28 with OffsetTime

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

the class TCKOffsetTime method test_isEqual_null.

@Test(expectedExceptions = NullPointerException.class)
public void test_isEqual_null() {
    OffsetTime a = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE);
    a.isEqual(null);
}
Also used : OffsetTime(java.time.OffsetTime) Test(org.testng.annotations.Test)

Example 29 with OffsetTime

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

the class TCKOffsetTime method test_minus_MinusAdjuster_zero.

@Test
public void test_minus_MinusAdjuster_zero() {
    OffsetTime t = TEST_11_30_59_500_PONE.minus(Period.ZERO);
    assertEquals(t, TEST_11_30_59_500_PONE);
}
Also used : OffsetTime(java.time.OffsetTime) Test(org.testng.annotations.Test)

Example 30 with OffsetTime

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

the class TCKOffsetTime method test_minusMinutes.

//-----------------------------------------------------------------------
// minusMinutes()
//-----------------------------------------------------------------------
@Test
public void test_minusMinutes() {
    OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE);
    OffsetTime test = base.minusMinutes(50);
    assertEquals(test, OffsetTime.of(10, 40, 59, 0, OFFSET_PONE));
}
Also used : OffsetTime(java.time.OffsetTime) Test(org.testng.annotations.Test)

Aggregations

OffsetTime (java.time.OffsetTime)95 Test (org.testng.annotations.Test)86 ZonedDateTime (java.time.ZonedDateTime)8 Instant (java.time.Instant)7 LocalTime (java.time.LocalTime)7 Time (java.sql.Time)6 OffsetDateTime (java.time.OffsetDateTime)6 LocalDate (java.time.LocalDate)5 LocalDateTime (java.time.LocalDateTime)5 Date (java.sql.Date)3 ResultSet (java.sql.ResultSet)3 Clock (java.time.Clock)3 PostgresUtils.toPGArrayString (org.jooq.util.postgres.PostgresUtils.toPGArrayString)3 BigDecimal (java.math.BigDecimal)2 PreparedStatement (java.sql.PreparedStatement)2 Timestamp (java.sql.Timestamp)2 DateTimeFormatter (java.time.format.DateTimeFormatter)2 Temporal (java.time.temporal.Temporal)2 TemporalAdjuster (java.time.temporal.TemporalAdjuster)2 UUID (java.util.UUID)2