use of org.immutables.criteria.typemodel.ImmutableLocalDateTimeHolder in project immutables by immutables.
the class JavaTimeTypeTest method localDateTime.
@Test
void localDateTime() {
LocalDateTimeHolderRepository repository = new LocalDateTimeHolderRepository(backend);
LocalDateTime value = LocalDateTime.now();
ImmutableLocalDateTimeHolder holder = TypeHolder.LocalDateTimeHolder.generator().get().withValue(value).withOptional(value).withNullable(null);
repository.insert(holder);
BsonDocument doc = fetch();
BsonDateTime expected = new BsonDateTime(value.toInstant(ZoneOffset.UTC).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