Search in sources :

Example 76 with OffsetTime

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

the class TCKOffsetTime method test_withHour_normal.

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

Example 77 with OffsetTime

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

the class TCKOffsetTime method test_minus_MinusAdjuster.

//-----------------------------------------------------------------------
// minus(MinusAdjuster)
//-----------------------------------------------------------------------
@Test
public void test_minus_MinusAdjuster() {
    MockSimplePeriod period = MockSimplePeriod.of(7, ChronoUnit.MINUTES);
    OffsetTime t = TEST_11_30_59_500_PONE.minus(period);
    assertEquals(t, OffsetTime.of(11, 23, 59, 500, OFFSET_PONE));
}
Also used : OffsetTime(java.time.OffsetTime) MockSimplePeriod(test.java.time.MockSimplePeriod) Test(org.testng.annotations.Test)

Example 78 with OffsetTime

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

the class TCKOffsetTime method factory_parse_validText.

//-----------------------------------------------------------------------
// parse()
//-----------------------------------------------------------------------
@Test(dataProvider = "sampleToString")
public void factory_parse_validText(int h, int m, int s, int n, String offsetId, String parsable) {
    OffsetTime t = OffsetTime.parse(parsable);
    assertNotNull(t, parsable);
    check(t, h, m, s, n, ZoneOffset.of(offsetId));
}
Also used : OffsetTime(java.time.OffsetTime) Test(org.testng.annotations.Test)

Example 79 with OffsetTime

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

the class TCKOffsetTime method test_get_TemporalField.

//-----------------------------------------------------------------------
// get(TemporalField)
//-----------------------------------------------------------------------
@Test
public void test_get_TemporalField() {
    OffsetTime test = OffsetTime.of(12, 30, 40, 987654321, OFFSET_PONE);
    assertEquals(test.get(ChronoField.HOUR_OF_DAY), 12);
    assertEquals(test.get(ChronoField.MINUTE_OF_HOUR), 30);
    assertEquals(test.get(ChronoField.SECOND_OF_MINUTE), 40);
    assertEquals(test.get(ChronoField.NANO_OF_SECOND), 987654321);
    assertEquals(test.get(ChronoField.HOUR_OF_AMPM), 0);
    assertEquals(test.get(ChronoField.AMPM_OF_DAY), 1);
    assertEquals(test.get(ChronoField.OFFSET_SECONDS), 3600);
}
Also used : OffsetTime(java.time.OffsetTime) Test(org.testng.annotations.Test)

Example 80 with OffsetTime

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

the class TCKOffsetTime method test_compareTo_time.

//-----------------------------------------------------------------------
// compareTo()
//-----------------------------------------------------------------------
@Test
public void test_compareTo_time() {
    OffsetTime a = OffsetTime.of(11, 29, 0, 0, OFFSET_PONE);
    // a is before b due to time
    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)

Aggregations

OffsetTime (java.time.OffsetTime)99 Test (org.testng.annotations.Test)86 ZonedDateTime (java.time.ZonedDateTime)9 LocalTime (java.time.LocalTime)8 Instant (java.time.Instant)7 OffsetDateTime (java.time.OffsetDateTime)7 Time (java.sql.Time)6 LocalDate (java.time.LocalDate)6 LocalDateTime (java.time.LocalDateTime)6 Test (org.junit.Test)6 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 Duration (java.time.Duration)2 Period (java.time.Period)2 ZoneId (java.time.ZoneId)2