use of java.time.Clock in project jdk8u_jdk by JetBrains.
the class TCKClock_System method test_systemDefaultZone.
public void test_systemDefaultZone() {
Clock test = Clock.systemDefaultZone();
assertEquals(test.getZone(), ZoneId.systemDefault());
assertEquals(test, Clock.system(ZoneId.systemDefault()));
}
use of java.time.Clock in project jdk8u_jdk by JetBrains.
the class TCKClock_System method test_hashCode.
public void test_hashCode() {
Clock a = Clock.system(ZoneOffset.UTC);
Clock b = Clock.system(ZoneOffset.UTC);
assertEquals(a.hashCode(), a.hashCode());
assertEquals(a.hashCode(), b.hashCode());
Clock c = Clock.system(PARIS);
assertEquals(a.hashCode() == c.hashCode(), false);
}
use of java.time.Clock in project jdk8u_jdk by JetBrains.
the class TCKClock_System method test_instant.
//-----------------------------------------------------------------------
public void test_instant() {
Clock system = Clock.systemUTC();
assertEquals(system.getZone(), ZoneOffset.UTC);
for (int i = 0; i < 10000; i++) {
// assume can eventually get these within 10 milliseconds
Instant instant = system.instant();
long systemMillis = System.currentTimeMillis();
if (systemMillis - instant.toEpochMilli() < 10) {
// success
return;
}
}
fail();
}
use of java.time.Clock in project jdk8u_jdk by JetBrains.
the class TCKClock_System method test_systemUTC.
//-------------------------------------------------------------------------
public void test_systemUTC() {
Clock test = Clock.systemUTC();
assertEquals(test.getZone(), ZoneOffset.UTC);
assertEquals(test, Clock.system(ZoneOffset.UTC));
}
use of java.time.Clock in project jdk8u_jdk by JetBrains.
the class TCKClock_System method test_withZone.
//-------------------------------------------------------------------------
public void test_withZone() {
Clock test = Clock.system(PARIS);
Clock changed = test.withZone(MOSCOW);
assertEquals(test.getZone(), PARIS);
assertEquals(changed.getZone(), MOSCOW);
}
Aggregations