use of java.time.Clock in project jdk8u_jdk by JetBrains.
the class TCKClock_System method test_withZone_equal.
public void test_withZone_equal() {
Clock test = Clock.system(PARIS);
Clock changed = test.withZone(PARIS);
assertEquals(changed.getZone(), PARIS);
}
use of java.time.Clock in project jdk8u_jdk by JetBrains.
the class TCKClock_Tick method test_withZone_equal.
public void test_withZone_equal() {
Clock test = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500));
Clock changed = test.withZone(PARIS);
assertEquals(test, changed);
}
use of java.time.Clock in project jdk8u_jdk by JetBrains.
the class TCKClock_Tick method test_tickMinutes_ZoneId.
//-----------------------------------------------------------------------
public void test_tickMinutes_ZoneId() {
Clock test = Clock.tickMinutes(PARIS);
assertEquals(test.getZone(), PARIS);
Instant instant = test.instant();
assertEquals(instant.getEpochSecond() % 60, 0);
assertEquals(instant.getNano(), 0);
}
use of java.time.Clock in project jdk8u_jdk by JetBrains.
the class TCKClock_Tick method test_tick_ClockDuration_250micros.
public void test_tick_ClockDuration_250micros() {
for (int i = 0; i < 1000; i++) {
Clock test = Clock.tick(Clock.fixed(ZDT.withNano(i * 1000).toInstant(), PARIS), Duration.ofNanos(250_000));
assertEquals(test.instant(), ZDT.withNano((i / 250) * 250_000).toInstant());
assertEquals(test.getZone(), PARIS);
}
}
use of java.time.Clock in project jdk8u_jdk by JetBrains.
the class TCKClock_Tick method test_hashCode.
public void test_hashCode() {
Clock a = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500));
Clock b = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500));
assertEquals(a.hashCode(), a.hashCode());
assertEquals(a.hashCode(), b.hashCode());
Clock c = Clock.tick(Clock.system(MOSCOW), Duration.ofMillis(500));
assertEquals(a.hashCode() == c.hashCode(), false);
Clock d = Clock.tick(Clock.system(PARIS), Duration.ofMillis(499));
assertEquals(a.hashCode() == d.hashCode(), false);
}
Aggregations