use of java.time.Clock in project j2objc by google.
the class TCKLocalDateTime method now_Clock_minYear.
@Test
public void now_Clock_minYear() {
Clock clock = Clock.fixed(MIN_INSTANT, ZoneOffset.UTC);
LocalDateTime test = LocalDateTime.now(clock);
assertEquals(test, MIN_DATE_TIME);
}
use of java.time.Clock in project j2objc by google.
the class TCKLocalDateTime method now_Clock_tooBig.
@Test(expected = DateTimeException.class)
public void now_Clock_tooBig() {
Clock clock = Clock.fixed(MAX_INSTANT.plusSeconds(24 * 60 * 60), ZoneOffset.UTC);
LocalDateTime.now(clock);
}
use of java.time.Clock in project j2objc by google.
the class TCKLocalDate method now_Clock_allSecsInDay_beforeEpoch.
@Test
public void now_Clock_allSecsInDay_beforeEpoch() {
for (int i = -1; i >= -(2 * 24 * 60 * 60); i--) {
Instant instant = Instant.ofEpochSecond(i);
Clock clock = Clock.fixed(instant, ZoneOffset.UTC);
LocalDate test = LocalDate.now(clock);
assertEquals(test.getYear(), 1969);
assertEquals(test.getMonth(), Month.DECEMBER);
assertEquals(test.getDayOfMonth(), (i >= -24 * 60 * 60 ? 31 : 30));
}
}
use of java.time.Clock in project j2objc by google.
the class TCKLocalDate method now_Clock_tooBig.
@Test(expected = DateTimeException.class)
public void now_Clock_tooBig() {
Clock clock = Clock.fixed(MAX_INSTANT.plusSeconds(24 * 60 * 60), ZoneOffset.UTC);
LocalDate.now(clock);
}
use of java.time.Clock in project j2objc by google.
the class TCKLocalDate method now_Clock_minYear.
@Test
public void now_Clock_minYear() {
Clock clock = Clock.fixed(MIN_INSTANT, ZoneOffset.UTC);
LocalDate test = LocalDate.now(clock);
assertEquals(test, MIN_DATE);
}
Aggregations