@Test
  protected void projection() {
    BigDecimal zero = BigDecimal.ZERO;
    BigDecimal one = BigDecimal.ONE;

    repository.insert(generator.get().withId("id1").withValue(zero).withNullable(null)
            .withOptional(Optional.empty()));

    repository.insert(generator.get().withId("id2").withValue(one).withNullable(one).withOptional(one));

    // projection of one attribute
    check(repository.findAll().select(criteria.value).fetch()).hasContentInAnyOrder(zero, one);
    check(repository.findAll().select(criteria.nullable).asOptional().fetch()).hasContentInAnyOrder(Optional.empty(), Optional.of(one));
    check(repository.findAll().select(criteria.optional).fetch()).hasContentInAnyOrder(Optional.empty(), Optional.of(one));

    // 4 attributes using mapper
    check(repository.findAll().select(criteria.id, criteria.value, criteria.nullable, criteria.optional)
            .map((id, value, nullable, optional) -> String.format("id=%s value=%s nullable=%s optional=%s", id, value, nullable, optional.orElse(null))).fetch())
            .hasContentInAnyOrder("id=id1 value=0 nullable=null optional=null", "id=id2 value=1 nullable=1 optional=1");

  }
Testing various string operations prefix/suffix/length etc.
criteria/common/test/org/immutables/criteria/typemodel/BigDecimalTemplate.java