private void logical(StringHolderCriteria criteria, int expected) {
    String query = Criterias.toQuery(criteria).filter().map(Objects::toString)
            .orElseThrow(() -> new IllegalStateException("Filter should be present"));
    List<?> result = repository.find(criteria).fetch();
    if (result.size() != expected) {
      Assertions.fail(String.format("Expected filter %n%s%n to return %d result(s) but got %d", query, expected, result.size()));
    }
  }
Expect empty result set (no documents matched)
criteria/common/test/org/immutables/criteria/typemodel/BooleanLogicTemplate.java