### Question:
FilterList implements Filter<K, T> { @Override public boolean filter(K key, T persistent) { boolean filtered = false; switch (operator.toString()) { case "MUST_PASS_ALL": for (Filter<K, T> filter: filters) { if (!filter.filter(key, persistent)) { return !filtered; } } break; case "MUST_PASS_ONE": for (Filter<K, T> filter: filters) { if (filter.filter(key, persistent)) { return !filtered; } } break; default: throw new IllegalStateException(operator + " not yet implemented!"); } return filtered; } FilterList();  FilterList(final List<Filter<K, T>> rowFilters);  FilterList(final Operator operator);  FilterList(final Operator operator, final List<Filter<K, T>> rowFilters); List<Filter<K, T>> getFilters(); Operator getOperator(); void addFilter(Filter<K, T> filter); @Override void readFields(DataInput in); @Override void write(DataOutput out); @Override boolean filter(K key, T persistent);  }### Answer:
@Test public void testOperatorMustPassAll() { filter1.setFieldName(WebPage.Field.OUTLINKS.toString()); filter1.setMapKey(new Utf8("example")); filter1.setFilterOp(FilterOp.EQUALS); filter1.setFilterIfMissing(true); filter1.getOperands().add(new Utf8("http: filter2.setFieldName(WebPage.Field.OUTLINKS.toString()); filter2.setFilterOp(FilterOp.EQUALS); filter2.setFilterIfMissing(true); filter2.getOperands().add(new Utf8("http: WebPage page = WebPage.newBuilder().build(); page.getOutlinks().put(new Utf8("example"), new Utf8("http: filterList = new FilterList<>(Operator.MUST_PASS_ALL, fList); assertTrue(filterList.filter("irrelevant", page)); }
@Test public void testOperatorMustPassOne() { filter1.setFieldName(WebPage.Field.OUTLINKS.toString()); filter1.setMapKey(new Utf8("example")); filter1.setFilterOp(FilterOp.EQUALS); filter1.setFilterIfMissing(true); filter1.getOperands().add(new Utf8("http: filter2.setFieldName(WebPage.Field.OUTLINKS.toString()); filter2.setFilterOp(FilterOp.EQUALS); filter2.setFilterIfMissing(true); filter2.getOperands().add(new Utf8("http: WebPage page = WebPage.newBuilder().build(); page.getOutlinks().put(new Utf8("example"), new Utf8("http: filterList = new FilterList<>(Operator.MUST_PASS_ONE, fList); assertTrue(filterList.filter("irrelevant", page)); }