@Test
  void booleanType() {
    BooleanHolderCriteria criteria = BooleanHolderCriteria.booleanHolder;
    check(Matchers.toExpression(criteria.value).returnType()).is(boolean.class);
    check(Matchers.toExpression(criteria.value.count()).returnType()).is(Long.class);

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