use of com.cadenzauk.core.lang.UncheckedAutoCloseable in project siesta by cadenzauk.
the class ZonedDateTimeConverterTest method convertToEntityAttributeGregorianShouldNotThrow.
@ParameterizedTest
@MethodSource("timezones")
void convertToEntityAttributeGregorianShouldNotThrow(String timeZone) {
ZonedDateTime dateTime = ZonedDateTime.of(LocalDateUtil.START_OF_GREGORIAN_CALENDAR, LocalTime.MIN, ZoneId.of(timeZone));
Timestamp input = Timestamp.from(dateTime.toInstant());
try (UncheckedAutoCloseable ignored = withTimeZone(timeZone)) {
ZonedDateTimeConverter sut = new ZonedDateTimeConverter(ZoneId.of(timeZone));
ZonedDateTime result = sut.convertToEntityAttribute(input);
assertThat(result, notNullValue());
}
}
use of com.cadenzauk.core.lang.UncheckedAutoCloseable in project siesta by cadenzauk.
the class ZonedDateTimeConverterTest method convertToDatabaseColumnGregorianShouldNotThrow.
@ParameterizedTest
@MethodSource("timezones")
void convertToDatabaseColumnGregorianShouldNotThrow(String timeZone) {
ZonedDateTime input = ZonedDateTime.of(LocalDateUtil.START_OF_GREGORIAN_CALENDAR, LocalTime.MIN, ZoneId.of(timeZone));
try (UncheckedAutoCloseable ignored = withTimeZone(timeZone)) {
ZonedDateTimeConverter sut = new ZonedDateTimeConverter(ZoneId.of(timeZone));
Timestamp result = sut.convertToDatabaseColumn(input);
assertThat(result, notNullValue());
}
}
Aggregations