@Test public void filterConditionShouldThrowWhenUnknownFilter() { Filter myFilter = (indentation -> null); assertThatThrownBy(() -> new FilterToCriteria().convert(myFilter)) .isInstanceOf(RuntimeException.class) .hasMessage("Unknown filter: " + myFilter.getClass()); }
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);  }