@Test
  void projection() {
    repository.insert(generator.get().withId("id1").withValue(true).withNullable(false).withBoxed(Boolean.TRUE).withOptional(Optional.of(false)));
    repository.insert(generator.get().withId("id2").withValue(false).withNullable(true).withBoxed(Boolean.FALSE).withOptional(Optional.of(true)));
    repository.insert(generator.get().withId("id3").withValue(false).withNullable(null).withBoxed(Boolean.TRUE).withOptional(Optional.empty()));

    // projection of one attribute
    check(repository.findAll().select(holder.id).fetch()).hasContentInAnyOrder("id1", "id2", "id3");
    check(repository.findAll().select(holder.value).fetch()).hasContentInAnyOrder(true, false, false);
    check(repository.findAll().select(holder.nullable).asOptional().fetch()).hasContentInAnyOrder(Optional.empty(), Optional.of(true), Optional.of(false));
    check(repository.findAll().select(holder.boxed).fetch()).hasContentInAnyOrder(Boolean.TRUE, Boolean.FALSE, Boolean.TRUE);
    check(repository.findAll().select(holder.optional).fetch()).hasContentInAnyOrder(Optional.empty(), Optional.of(true), Optional.of(false));

    // 2 attributes using tuple
    check(repository.findAll().select(holder.nullable, holder.optional)
            .map(tuple -> String.format("nullable=%s optional=%s", tuple.get(holder.nullable), tuple.get(holder.optional).map(Objects::toString).orElse("<empty>"))).fetch())
            .hasContentInAnyOrder("nullable=false optional=false", "nullable=true optional=true", "nullable=null optional=<empty>");
    // 2 attributes using mapper
    check(repository.findAll().select(holder.nullable, holder.optional)
            .map((nullable, optional) -> String.format("nullable=%s optional=%s", nullable, optional.map(Objects::toString).orElse("<empty>"))).fetch())
            .hasContentInAnyOrder("nullable=false optional=false", "nullable=true optional=true", "nullable=null optional=<empty>");

    // 3 attributes using tuple
    check(repository.findAll().select(holder.id, holder.nullable, holder.optional)
            .map(tuple -> String.format("id=%s nullable=%s optional=%s", tuple.get(holder.id), tuple.get(holder.nullable), tuple.get(holder.optional).map(Objects::toString).orElse("<empty>"))).fetch())
            .hasContentInAnyOrder("id=id1 nullable=false optional=false", "id=id2 nullable=true optional=true", "id=id3 nullable=null optional=<empty>");
    // 3 attributes using mapper
    check(repository.findAll().select(holder.id, holder.nullable, holder.optional)
            .map((id, nullable, optional) -> String.format("id=%s nullable=%s optional=%s", id, nullable, optional.map(Objects::toString).orElse("<empty>"))).fetch())
            .hasContentInAnyOrder("id=id1 nullable=false optional=false", "id=id2 nullable=true optional=true", "id=id3 nullable=null optional=<empty>");

    // 4 attributes using mapper
    check(repository.findAll().select(holder.id, holder.value, holder.nullable, holder.optional)
            .map((id, value, nullable, optional) -> String.format("id=%s value=%s nullable=%s optional=%s", id, value, nullable, optional.map(Objects::toString).orElse("<empty>"))).fetch())
            .hasContentInAnyOrder("id=id1 value=true nullable=false optional=false", "id=id2 value=false nullable=true optional=true", "id=id3 value=false nullable=null optional=<empty>");
  }
Check for empty results on empty backend
criteria/common/test/org/immutables/criteria/typemodel/BooleanTemplate.java