@Test
  protected void comparison() {
    final LocalDateTime date1 = LocalDateTime.of(2010, 5, 1, 22, 0);
    final LocalDateTime date2 = LocalDateTime.of(2010, 10, 2, 22, 0);
    // invariant date1 < date2
    Assertions.assertTrue(date1.compareTo(date2) < 0, String.format("Invariant: %s < %s", date1, date2));

    repository.insert(generator.get().withId("id1").withValue(date1));
    repository.insert(generator.get().withId("id2").withValue(date2));

    ids(holder.value.greaterThan(date2)).isEmpty();
    ids(holder.value.greaterThan(date1)).hasContentInAnyOrder("id2");
    ids(holder.value.lessThan(date1)).isEmpty();
    ids(holder.value.lessThan(date2)).hasContentInAnyOrder("id1");
    ids(holder.value.between(date1, date2)).hasContentInAnyOrder("id1", "id2");
    ids(holder.value.between(date2.plusDays(1), date2.plusDays(2))).isEmpty();
    ids(holder.value.between(date2, date1)).isEmpty();
    ids(holder.value.atMost(date1)).hasContentInAnyOrder("id1");
    ids(holder.value.atMost(date1.minusDays(1))).isEmpty();
    ids(holder.value.atMost(date2)).hasContentInAnyOrder("id1", "id2");
    ids(holder.value.atLeast(date1)).hasContentInAnyOrder("id1", "id2");
    ids(holder.value.atLeast(date2)).hasContentInAnyOrder("id2");
    ids(holder.value.atLeast(date2.plusDays(1))).isEmpty();
  }
Testing predicates, projections, sorting etc. on booleans
criteria/common/test/org/immutables/criteria/typemodel/LocalDateTimeTemplate.java