@Test
  void string() {
    StringHolderCriteria criteria = StringHolderCriteria.stringHolder;
    check(Matchers.toExpression(criteria.value).returnType()).is(String.class);
    check(Matchers.toExpression(criteria.value.min()).returnType()).is(String.class);
    check(Matchers.toExpression(criteria.value.max()).returnType()).is(String.class);
    check(Matchers.toExpression(criteria.value.count()).returnType()).is(Long.class);
    check(Matchers.toExpression(criteria.optional).returnType()).is(new TypeToken<Optional<String>>() {}.getType());
    check(Matchers.toExpression(criteria.optional.min()).returnType()).is(new TypeToken<Optional<String>>() {}.getType());
    check(Matchers.toExpression(criteria.optional.max()).returnType()).is(new TypeToken<Optional<String>>() {}.getType());
    check(Matchers.toExpression(criteria.value.count()).returnType()).is(Long.class);

    check(projectionType(criteria.value)).is(String.class);
    check(projectionType(criteria.nullable)).is(String.class);
    check(projectionType(criteria.optional)).is(new TypeToken<Optional<String>>() {}.getType());
  }
Check return and projection types for different types of matchers
criteria/common/test/org/immutables/criteria/matcher/ReturnTypeTest.java