@Test public void filter() { Object object1 = new Object(); Object object2 = new Object(); Object object3 = new Object(); List<Object> list1 = new ArrayList<Object>(); list1.add(object1); list1.add(object2); List<Object> list2 = new ArrayList<Object>(); list2.add(object2); list2.add(object3); doReturn(list1).doReturn(list2).when(filter).filter(anyList()); List<Object> actualObjects = andFilter.filter(list1); assertEquals(object2, actualObjects.get(0)); }
public List<Object> filter(final List<Object> objects) { List<Object> results = new ArrayList<>(); for (final Filter filter : filters) { results = filter.filter(objects); } return results; }
AndFilter extends LogicalFilter { public List<Object> filter(final List<Object> objects) { List<Object> results = new ArrayList<>(); for (final Filter filter : filters) { results = filter.filter(objects); } return results; } }
AndFilter extends LogicalFilter { public List<Object> filter(final List<Object> objects) { List<Object> results = new ArrayList<>(); for (final Filter filter : filters) { results = filter.filter(objects); } return results; } AndFilter(final Filter... filters); }
AndFilter extends LogicalFilter { public List<Object> filter(final List<Object> objects) { List<Object> results = new ArrayList<>(); for (final Filter filter : filters) { results = filter.filter(objects); } return results; } AndFilter(final Filter... filters); Filter[] getFilters(); List<Object> filter(final List<Object> objects); }
AndFilter extends LogicalFilter { public List<Object> filter(final List<Object> objects) { List<Object> results = new ArrayList<>(); for (final Filter filter : filters) { results = filter.filter(objects); } return results; } AndFilter(final Filter... filters); Filter[] getFilters(); List<Object> filter(final List<Object> objects);  }