Search in sources :

Example 6 with OffsetTime

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

the class TCKOffsetTime method test_plusMinutes_zero.

@Test
public void test_plusMinutes_zero() {
    OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE);
    OffsetTime test = base.plusMinutes(0);
    assertEquals(test, base);
}
Also used : OffsetTime(java.time.OffsetTime) Test(org.testng.annotations.Test)

Example 7 with OffsetTime

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

the class TCKOffsetTime method test_minusSeconds_zero.

@Test
public void test_minusSeconds_zero() {
    OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE);
    OffsetTime test = base.minusSeconds(0);
    assertEquals(test, base);
}
Also used : OffsetTime(java.time.OffsetTime) Test(org.testng.annotations.Test)

Example 8 with OffsetTime

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

the class TCKOffsetTime method test_compareTo_offset.

@Test
public void test_compareTo_offset() {
    OffsetTime a = OffsetTime.of(11, 30, 0, 0, OFFSET_PTWO);
    // a is before b due to offset
    OffsetTime b = OffsetTime.of(11, 30, 0, 0, OFFSET_PONE);
    assertEquals(a.compareTo(b) < 0, true);
    assertEquals(b.compareTo(a) > 0, true);
    assertEquals(a.compareTo(a) == 0, true);
    assertEquals(b.compareTo(b) == 0, true);
    assertEquals(convertInstant(a).compareTo(convertInstant(b)) < 0, true);
}
Also used : OffsetTime(java.time.OffsetTime) Test(org.testng.annotations.Test)

Example 9 with OffsetTime

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

the class TCKOffsetTime method test_isBeforeIsAfterIsEqual2nanos.

@Test
public void test_isBeforeIsAfterIsEqual2nanos() {
    OffsetTime a = OffsetTime.of(11, 30, 59, 4, ZoneOffset.ofTotalSeconds(OFFSET_PONE.getTotalSeconds() + 1));
    // a is before b due to offset
    OffsetTime b = OffsetTime.of(11, 30, 59, 3, OFFSET_PONE);
    assertEquals(a.isBefore(b), true);
    assertEquals(a.isEqual(b), false);
    assertEquals(a.isAfter(b), false);
    assertEquals(b.isBefore(a), false);
    assertEquals(b.isEqual(a), false);
    assertEquals(b.isAfter(a), true);
    assertEquals(a.isBefore(a), false);
    assertEquals(b.isBefore(b), false);
    assertEquals(a.isEqual(a), true);
    assertEquals(b.isEqual(b), true);
    assertEquals(a.isAfter(a), false);
    assertEquals(b.isAfter(b), false);
}
Also used : OffsetTime(java.time.OffsetTime) Test(org.testng.annotations.Test)

Example 10 with OffsetTime

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

the class TCKOffsetTime method test_until_convertedType.

@Test
public void test_until_convertedType() {
    OffsetTime offsetTime = OffsetTime.of(1, 1, 1, 0, OFFSET_PONE);
    OffsetDateTime offsetDateTime = offsetTime.plusSeconds(3).atDate(LocalDate.of(1980, 2, 10));
    assertEquals(offsetTime.until(offsetDateTime, SECONDS), 3);
}
Also used : OffsetDateTime(java.time.OffsetDateTime) 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