Search in sources :

Example 21 with OffsetTime

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

the class TCKZonedDateTime method test_with_adjuster_OffsetTime_validOffsetNotInOverlap.

@Test
public void test_with_adjuster_OffsetTime_validOffsetNotInOverlap() {
    // OT has valid offset for resulting time
    OffsetTime ot = OffsetTime.of(15, 50, 30, 40, OFFSET_0100);
    ZonedDateTime zdt = TEST_PARIS_OVERLAP_2008_10_26_02_30.atZone(ZONE_PARIS);
    ZonedDateTime test = zdt.with(ot);
    assertEquals(test.toLocalDateTime(), dateTime(2008, 10, 26, 15, 50, 30, 40));
    assertEquals(test.getOffset(), OFFSET_0100);
}
Also used : ZonedDateTime(java.time.ZonedDateTime) OffsetTime(java.time.OffsetTime) Test(org.testng.annotations.Test)

Example 22 with OffsetTime

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

the class TCKOffsetTime method test_isBeforeIsAfterIsEqual1nanos.

@Test
public void test_isBeforeIsAfterIsEqual1nanos() {
    OffsetTime a = OffsetTime.of(11, 30, 59, 3, OFFSET_PONE);
    // a is before b due to time
    OffsetTime b = OffsetTime.of(11, 30, 59, 4, 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 23 with OffsetTime

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

the class TCKOffsetTime method test_withMinute_noChange.

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

Example 24 with OffsetTime

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

the class TCKOffsetTime method test_until_invalidTemporalUnit.

@Test(expectedExceptions = DateTimeException.class)
public void test_until_invalidTemporalUnit() {
    OffsetTime offsetTime1 = OffsetTime.of(1, 1, 1, 0, OFFSET_PONE);
    OffsetTime offsetTime2 = OffsetTime.of(2, 1, 1, 0, OFFSET_PONE);
    offsetTime1.until(offsetTime2, MONTHS);
}
Also used : OffsetTime(java.time.OffsetTime) Test(org.testng.annotations.Test)

Example 25 with OffsetTime

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

the class TCKOffsetTime method test_minusNanos.

//-----------------------------------------------------------------------
// minusNanos()
//-----------------------------------------------------------------------
@Test
public void test_minusNanos() {
    OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE);
    OffsetTime test = base.minusNanos(1);
    assertEquals(test, OffsetTime.of(11, 30, 58, 999999999, 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