@Test public void filterConditionShouldMapWhenIsNotAnswered() { Stream<SearchQuery.Criterion> criteria = new FilterToCriteria().convert(FilterCondition.builder() .isAnswered(false) .build()); assertThat(criteria).containsExactly(SearchQuery.flagIsUnSet(Flag.ANSWERED)); }
public Stream<Criterion> convert(Filter filter) { if (filter instanceof FilterCondition) { return convertCondition((FilterCondition) filter); } if (filter instanceof FilterOperator) { return Stream.of(convertOperator((FilterOperator) filter)); } throw new RuntimeException("Unknown filter: " + filter.getClass()); }
FilterToCriteria { public Stream<Criterion> convert(Filter filter) { if (filter instanceof FilterCondition) { return convertCondition((FilterCondition) filter); } if (filter instanceof FilterOperator) { return Stream.of(convertOperator((FilterOperator) filter)); } throw new RuntimeException("Unknown filter: " + filter.getClass()); } }
FilterToCriteria { public Stream<Criterion> convert(Filter filter) { if (filter instanceof FilterCondition) { return convertCondition((FilterCondition) filter); } if (filter instanceof FilterOperator) { return Stream.of(convertOperator((FilterOperator) filter)); } throw new RuntimeException("Unknown filter: " + filter.getClass()); }  }
FilterToCriteria { public Stream<Criterion> convert(Filter filter) { if (filter instanceof FilterCondition) { return convertCondition((FilterCondition) filter); } if (filter instanceof FilterOperator) { return Stream.of(convertOperator((FilterOperator) filter)); } throw new RuntimeException("Unknown filter: " + filter.getClass()); }  Stream<Criterion> convert(Filter filter); }
FilterToCriteria { public Stream<Criterion> convert(Filter filter) { if (filter instanceof FilterCondition) { return convertCondition((FilterCondition) filter); } if (filter instanceof FilterOperator) { return Stream.of(convertOperator((FilterOperator) filter)); } throw new RuntimeException("Unknown filter: " + filter.getClass()); }  Stream<Criterion> convert(Filter filter);  }