use of java.time.OffsetDateTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetDateTime method test_withDayOfYear_normal.
//-----------------------------------------------------------------------
// withDayOfYear(int)
//-----------------------------------------------------------------------
@Test
public void test_withDayOfYear_normal() {
OffsetDateTime t = TEST_2008_6_30_11_30_59_000000500.withDayOfYear(33);
assertEquals(t, OffsetDateTime.of(LocalDate.of(2008, 2, 2), LocalTime.of(11, 30, 59, 500), OFFSET_PONE));
}
use of java.time.OffsetDateTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetDateTime method test_equals_false_second_differs.
@Test(dataProvider = "sampleTimes")
public void test_equals_false_second_differs(int y, int o, int d, int h, int m, int s, int n, ZoneOffset ignored) {
s = (s == 59 ? 58 : s);
OffsetDateTime a = OffsetDateTime.of(y, o, d, h, m, s, n, OFFSET_PONE);
OffsetDateTime b = OffsetDateTime.of(y, o, d, h, m, s + 1, n, OFFSET_PONE);
assertEquals(a.equals(b), false);
}
use of java.time.OffsetDateTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetDateTime method test_atZoneSimilarLocal_dstGap.
@Test
public void test_atZoneSimilarLocal_dstGap() {
OffsetDateTime t = OffsetDateTime.of(2007, 4, 1, 0, 0, 0, 0, OFFSET_MTWO);
assertEquals(t.atZoneSimilarLocal(ZONE_GAZA), ZonedDateTime.of(2007, 4, 1, 1, 0, 0, 0, ZONE_GAZA));
}
use of java.time.OffsetDateTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetDateTime method test_withSecond_normal.
//-----------------------------------------------------------------------
// withSecond()
//-----------------------------------------------------------------------
@Test
public void test_withSecond_normal() {
OffsetDateTime base = OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 59), OFFSET_PONE);
OffsetDateTime test = base.withSecond(15);
assertEquals(test, OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 15), OFFSET_PONE));
}
use of java.time.OffsetDateTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetDateTime method test_parse.
//-----------------------------------------------------------------------
// parse()
//-----------------------------------------------------------------------
@Test(dataProvider = "sampleToString")
public void test_parse(int y, int month, int d, int h, int m, int s, int n, String offsetId, String text) {
OffsetDateTime t = OffsetDateTime.parse(text);
assertEquals(t.getYear(), y);
assertEquals(t.getMonth().getValue(), month);
assertEquals(t.getDayOfMonth(), d);
assertEquals(t.getHour(), h);
assertEquals(t.getMinute(), m);
assertEquals(t.getSecond(), s);
assertEquals(t.getNano(), n);
assertEquals(t.getOffset().getId(), offsetId);
}
Aggregations