use of java.time.ZoneId in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method now_ZoneId.
@Test
public void now_ZoneId() {
ZoneId zone = ZoneId.of("UTC+01:02:03");
LocalDateTime expected = LocalDateTime.now(Clock.system(zone));
LocalDateTime test = LocalDateTime.now(zone);
for (int i = 0; i < 100; i++) {
if (expected.equals(test)) {
return;
}
expected = LocalDateTime.now(Clock.system(zone));
test = LocalDateTime.now(zone);
}
assertEquals(test, expected);
}
use of java.time.ZoneId in project jdk8u_jdk by JetBrains.
the class TCKChronology method test_IsoChronology_dateNow.
@Test
public void test_IsoChronology_dateNow() {
ZoneId zoneId_paris = ZoneId.of("Europe/Paris");
Clock clock = Clock.system(zoneId_paris);
Chronology chrono = Chronology.of("ISO");
assertEquals(chrono.dateNow(), IsoChronology.INSTANCE.dateNow());
assertEquals(chrono.dateNow(zoneId_paris), IsoChronology.INSTANCE.dateNow(zoneId_paris));
assertEquals(chrono.dateNow(clock), IsoChronology.INSTANCE.dateNow(clock));
}
use of java.time.ZoneId in project jdk8u_jdk by JetBrains.
the class TCKChronology method test_ThaiBuddhistChronology_dateNow.
@Test
public void test_ThaiBuddhistChronology_dateNow() {
ZoneId zoneId_paris = ZoneId.of("Europe/Paris");
Clock clock = Clock.system(zoneId_paris);
Chronology chrono = Chronology.of("ThaiBuddhist");
assertEquals(chrono.dateNow(), ThaiBuddhistChronology.INSTANCE.dateNow());
assertEquals(chrono.dateNow(zoneId_paris), ThaiBuddhistChronology.INSTANCE.dateNow(zoneId_paris));
assertEquals(chrono.dateNow(clock), ThaiBuddhistChronology.INSTANCE.dateNow(clock));
}
use of java.time.ZoneId in project jdk8u_jdk by JetBrains.
the class TCKChronology method test_JapaneseChronology_dateNow.
@Test
public void test_JapaneseChronology_dateNow() {
ZoneId zoneId_paris = ZoneId.of("Europe/Paris");
Clock clock = Clock.system(zoneId_paris);
Chronology chrono = Chronology.of("Japanese");
assertEquals(chrono.dateNow(), JapaneseChronology.INSTANCE.dateNow());
assertEquals(chrono.dateNow(zoneId_paris), JapaneseChronology.INSTANCE.dateNow(zoneId_paris));
assertEquals(chrono.dateNow(clock), JapaneseChronology.INSTANCE.dateNow(clock));
}
use of java.time.ZoneId in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method now_ZoneId.
@Test
public void now_ZoneId() {
ZoneId zone = ZoneId.of("UTC+01:02:03");
LocalTime expected = LocalTime.now(Clock.system(zone));
LocalTime test = LocalTime.now(zone);
for (int i = 0; i < 100; i++) {
if (expected.equals(test)) {
return;
}
expected = LocalTime.now(Clock.system(zone));
test = LocalTime.now(zone);
}
assertEquals(test, expected);
}
Aggregations