use of org.immutables.criteria.typemodel.ImmutableLocalDateHolder in project immutables by immutables.
the class JavaTimeTypeTest method localDate.
@Test
void localDate() {
LocalDateHolderRepository repository = new LocalDateHolderRepository(backend);
LocalDate value = LocalDate.now();
ImmutableLocalDateHolder holder = TypeHolder.LocalDateHolder.generator().get().withValue(value).withOptional(value).withNullable(null);
repository.insert(holder);
BsonDocument doc = fetch();
BsonDateTime expected = new BsonDateTime(value.atStartOfDay(ZoneOffset.UTC).toInstant().toEpochMilli());
check(doc.get("value")).is(expected);
check(doc.get("optional")).is(expected);
if (doc.containsKey("nullable")) {
check(doc.get("nullable")).is(BsonNull.VALUE);
}
}
Aggregations