use of org.immutables.criteria.typemodel.ImmutableInstantHolder in project immutables by immutables.
the class JavaTimeTypeTest method instant.
@Test
void instant() {
InstantHolderRepository repository = new InstantHolderRepository(backend);
Instant value = Instant.now();
ImmutableInstantHolder holder = TypeHolder.InstantHolder.generator().get().withValue(value).withOptional(value).withNullable(null);
repository.insert(holder);
BsonDocument doc = fetch();
BsonDateTime expected = new BsonDateTime(value.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