@Test
  void nullable() {
    Instant date = Instant.now();
    repository.insert(generator.get().withId("id1").withNullable(null));
    repository.insert(generator.get().withId("id2").withNullable(date));

    ids(holder.nullable.isPresent()).hasContentInAnyOrder("id2");
    ids(holder.nullable.isAbsent()).hasContentInAnyOrder("id1");
    ids(holder.nullable.is(date)).hasContentInAnyOrder("id2");
    ids(holder.nullable.atLeast(date)).hasContentInAnyOrder("id2");
    ids(holder.nullable.atMost(date)).hasContentInAnyOrder("id2");
    ids(holder.nullable.greaterThan(date)).isEmpty();
    ids(holder.nullable.lessThan(date)).isEmpty();

    // using OptionalValue matcher API
    ids(holder.nullable.is(Optional.empty())).isOf("id1");
    ids(holder.nullable.is(Optional.of(date))).isOf("id2");
    ids(holder.nullable.isNot(Optional.empty())).isOf("id2");
  }
Testing predicates, projections, sorting etc. on booleans
criteria/common/test/org/immutables/criteria/typemodel/InstantTemplate.java