use of java.time.ZonedDateTime in project jdk8u_jdk by JetBrains.
the class TCKZonedDateTime method test_equals_false_hour_differs.
@Test(dataProvider = "sampleTimes")
public void test_equals_false_hour_differs(int y, int o, int d, int h, int m, int s, int n, ZoneId ignored) {
h = (h == 23 ? 22 : h);
ZonedDateTime a = ZonedDateTime.of(dateTime(y, o, d, h, m, s, n), ZONE_0100);
ZonedDateTime b = ZonedDateTime.of(dateTime(y, o, d, h + 1, m, s, n), ZONE_0100);
assertEquals(a.equals(b), false);
}
use of java.time.ZonedDateTime in project jdk8u_jdk by JetBrains.
the class TCKZonedDateTime method test_minus_TemporalAmount_Duration.
@Test
public void test_minus_TemporalAmount_Duration() {
Duration duration = Duration.ofSeconds(4L * 60 * 60 + 5L * 60 + 6L);
ZonedDateTime t = ZonedDateTime.of(LocalDateTime.of(2008, 6, 1, 12, 30, 59, 500), ZONE_0100);
ZonedDateTime expected = ZonedDateTime.of(LocalDateTime.of(2008, 6, 1, 8, 25, 53, 500), ZONE_0100);
assertEquals(t.minus(duration), expected);
}
use of java.time.ZonedDateTime in project jdk8u_jdk by JetBrains.
the class TCKZonedDateTime method test_isBefore_null.
@Test(expectedExceptions = NullPointerException.class)
public void test_isBefore_null() {
ZonedDateTime a = ZonedDateTime.of(2008, 6, 30, 23, 30, 59, 0, ZONE_0100);
a.isBefore(null);
}
use of java.time.ZonedDateTime in project jdk8u_jdk by JetBrains.
the class TCKZonedDateTime method test_toEpochSecond_afterEpoch.
//-----------------------------------------------------------------------
// toEpochSecond()
//-----------------------------------------------------------------------
@Test
public void test_toEpochSecond_afterEpoch() {
LocalDateTime ldt = LocalDateTime.of(1970, 1, 1, 0, 0).plusHours(1);
for (int i = 0; i < 100000; i++) {
ZonedDateTime a = ZonedDateTime.of(ldt, ZONE_PARIS);
assertEquals(a.toEpochSecond(), i);
ldt = ldt.plusSeconds(1);
}
}
use of java.time.ZonedDateTime in project jdk8u_jdk by JetBrains.
the class TCKZonedDateTime method test_isAfter.
@Test(dataProvider = "IsAfter")
public void test_isAfter(int hour1, int minute1, ZoneId zone1, int hour2, int minute2, ZoneId zone2, boolean expected) {
ZonedDateTime a = ZonedDateTime.of(2008, 6, 30, hour1, minute1, 0, 0, zone1);
ZonedDateTime b = ZonedDateTime.of(2008, 6, 30, hour2, minute2, 0, 0, zone2);
assertEquals(a.isAfter(b), expected);
assertEquals(b.isAfter(a), false);
assertEquals(a.isAfter(a), false);
assertEquals(b.isAfter(b), false);
}
Aggregations