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);
}
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);
}
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);
}
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);
}
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));
}
Aggregations