@Test
  void enumType() {
    EnumHolderCriteria criteria = EnumHolderCriteria.enumHolder;
    check(Matchers.toExpression(criteria.value).returnType()).is(TypeHolder.Foo.class);
    check(Matchers.toExpression(criteria.nullable).returnType()).is(TypeHolder.Foo.class);
    check(Matchers.toExpression(criteria.optional).returnType()).is(new TypeToken<Optional<TypeHolder.Foo>>() {}.getType());
    check(projectionType(criteria.value)).is(TypeHolder.Foo.class);
    check(projectionType(criteria.nullable)).is(TypeHolder.Foo.class);
    check(projectionType(criteria.optional)).is(new TypeToken<Optional<TypeHolder.Foo>>() {}.getType());
  }
Check return and projection types for different types of matchers
criteria/common/test/org/immutables/criteria/matcher/ReturnTypeTest.java