use of java.time.OffsetDateTime in project jdk8u_jdk by JetBrains.
the class TestOffsetDateTime method test_plusMinutes_zero.
@Test
public void test_plusMinutes_zero() {
OffsetDateTime base = OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 59), OFFSET_PONE);
OffsetDateTime test = base.plusMinutes(0);
assertSame(test, base);
}
use of java.time.OffsetDateTime 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);
}
use of java.time.OffsetDateTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetDateTime method test_compareTo_both.
@Test
public void test_compareTo_both() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 50, 0, 0, OFFSET_PTWO);
// a is before b on instant scale
OffsetDateTime b = OffsetDateTime.of(2008, 6, 30, 11, 20, 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(a.toInstant().compareTo(b.toInstant()) < 0, true);
assertEquals(OffsetDateTime.timeLineOrder().compare(a, b) < 0, true);
}
use of java.time.OffsetDateTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetDateTime method test_withDayOfMonth_normal.
//-----------------------------------------------------------------------
// withDayOfMonth()
//-----------------------------------------------------------------------
@Test
public void test_withDayOfMonth_normal() {
OffsetDateTime base = OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 59), OFFSET_PONE);
OffsetDateTime test = base.withDayOfMonth(15);
assertEquals(test, OffsetDateTime.of(LocalDate.of(2008, 6, 15), LocalTime.of(11, 30, 59), OFFSET_PONE));
}
use of java.time.OffsetDateTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetDateTime method test_minusMonths.
//-----------------------------------------------------------------------
// minusMonths()
//-----------------------------------------------------------------------
@Test
public void test_minusMonths() {
OffsetDateTime base = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
OffsetDateTime test = base.minusMonths(1);
assertEquals(test, OffsetDateTime.of(2008, 5, 30, 11, 30, 59, 0, OFFSET_PONE));
}
Aggregations