use of java.time.ZonedDateTime in project jdk8u_jdk by JetBrains.
the class TCKZonedDateTime method test_minusNanos_nanos.
@Test
public void test_minusNanos_nanos() {
LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0);
ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100);
ZonedDateTime test = base.minusNanos(1);
assertEquals(test, ZonedDateTime.of(ldt.minusNanos(1), ZONE_0100));
}
use of java.time.ZonedDateTime in project jdk8u_jdk by JetBrains.
the class TCKZonedDateTime method test_withYear_normal.
//-----------------------------------------------------------------------
// withYear()
//-----------------------------------------------------------------------
@Test
public void test_withYear_normal() {
ZonedDateTime base = ZonedDateTime.of(TEST_LOCAL_2008_06_30_11_30_59_500, ZONE_0100);
ZonedDateTime test = base.withYear(2007);
assertEquals(test, ZonedDateTime.of(TEST_LOCAL_2008_06_30_11_30_59_500.withYear(2007), ZONE_0100));
}
use of java.time.ZonedDateTime in project jdk8u_jdk by JetBrains.
the class TCKZonedDateTime method test_with_adjuster_Offset_same.
@Test
public void test_with_adjuster_Offset_same() {
ZonedDateTime base = ZonedDateTime.of(LocalDateTime.of(2012, 7, 31, 0, 0), ZONE_PARIS);
ZonedDateTime test = base.with(ZoneOffset.ofHours(2));
check(test, 2012, 7, 31, 0, 0, 0, 0, OFFSET_0200, ZONE_PARIS);
}
use of java.time.ZonedDateTime in project jdk8u_jdk by JetBrains.
the class TCKZonedDateTime method factory_ofInstant_allDaysInCycle.
@Test
public void factory_ofInstant_allDaysInCycle() {
// sanity check using different algorithm
ZonedDateTime expected = LocalDateTime.of(1970, 1, 1, 0, 0, 0, 0).atZone(ZoneOffset.UTC);
for (long i = 0; i < 146097; i++) {
Instant instant = Instant.ofEpochSecond(i * 24L * 60L * 60L);
ZonedDateTime test = ZonedDateTime.ofInstant(instant, ZoneOffset.UTC);
assertEquals(test, expected);
expected = expected.plusDays(1);
}
}
use of java.time.ZonedDateTime in project jdk8u_jdk by JetBrains.
the class TCKZonedDateTime method test_minusSeconds_seconds.
@Test
public void test_minusSeconds_seconds() {
LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0);
ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100);
ZonedDateTime test = base.minusSeconds(1);
assertEquals(test, ZonedDateTime.of(ldt.minusSeconds(1), ZONE_0100));
}
Aggregations