private void checkQuery(final Function<FieldsQueryModel<Category>, QueryPredicate<Category>> f) { final CategoryQuery categoryQuery = CategoryQuery.of() .plusPredicates(m -> m.is(typeFixtureRule.getCategory())) .plusPredicates( m -> { return f.apply(m.custom().fields()); }); final List<Category> results = client().executeBlocking(categoryQuery).getResults(); assertThat(results).hasSize(1); assertThat(results.get(0)).isEqualTo(typeFixtureRule.getCategory()); }
@Test public void queryByReference() { final CategoryQuery categoryQuery = CategoryQuery.of() .plusPredicates(m -> m.is(typeFixtureRule.getCategory())) .plusPredicates( m -> m.custom().fields().ofReference(CAT_REFERENCE_FIELD_NAME).id().is("x")); final List<Category> results = client().executeBlocking(categoryQuery).getResults(); assertThat(results).hasSize(0); }