@Test public void filtersByAnyFilterForMultipleFilters() throws Exception { ResourceDescriptionFilter innerFilter1 = mock(ResourceDescriptionFilter.class); when(innerFilter1.accept(RESOURCE_DESCRIPTIONS.get(0))).thenReturn(true); when(innerFilter1.accept(RESOURCE_DESCRIPTIONS.get(1))).thenReturn(false); when(innerFilter1.accept(RESOURCE_DESCRIPTIONS.get(2))).thenReturn(true); when(innerFilter1.accept(RESOURCE_DESCRIPTIONS.get(3))).thenReturn(true); ResourceDescriptionFilter innerFilter2 = mock(ResourceDescriptionFilter.class); when(innerFilter2.accept(RESOURCE_DESCRIPTIONS.get(0))).thenReturn(true); when(innerFilter2.accept(RESOURCE_DESCRIPTIONS.get(1))).thenReturn(true); when(innerFilter2.accept(RESOURCE_DESCRIPTIONS.get(2))).thenReturn(true); when(innerFilter2.accept(RESOURCE_DESCRIPTIONS.get(3))).thenReturn(false); FederatedResourceDescriptionFilter filter = new FederatedResourceDescriptionFilter(innerFilter1, innerFilter2); assertTrue(filter.accept(RESOURCE_DESCRIPTIONS.get(0))); assertFalse(filter.accept(RESOURCE_DESCRIPTIONS.get(1))); assertTrue(filter.accept(RESOURCE_DESCRIPTIONS.get(2))); assertFalse(filter.accept(RESOURCE_DESCRIPTIONS.get(3))); }
@Override public boolean accept(ResourceDescription resourceDescription) { for (ResourceDescriptionFilter filter : filters) { if (!filter.accept(resourceDescription)) { return false; } } return true; }
FederatedResourceDescriptionFilter implements ResourceDescriptionFilter { @Override public boolean accept(ResourceDescription resourceDescription) { for (ResourceDescriptionFilter filter : filters) { if (!filter.accept(resourceDescription)) { return false; } } return true; } }
FederatedResourceDescriptionFilter implements ResourceDescriptionFilter { @Override public boolean accept(ResourceDescription resourceDescription) { for (ResourceDescriptionFilter filter : filters) { if (!filter.accept(resourceDescription)) { return false; } } return true; } protected  FederatedResourceDescriptionFilter(ResourceDescriptionFilter... filters); }
FederatedResourceDescriptionFilter implements ResourceDescriptionFilter { @Override public boolean accept(ResourceDescription resourceDescription) { for (ResourceDescriptionFilter filter : filters) { if (!filter.accept(resourceDescription)) { return false; } } return true; } protected  FederatedResourceDescriptionFilter(ResourceDescriptionFilter... filters); static ResourceDescriptionFilter fromList(List<ResourceDescriptionFilter> inputFilters); @Override boolean accept(ResourceDescription resourceDescription); }
FederatedResourceDescriptionFilter implements ResourceDescriptionFilter { @Override public boolean accept(ResourceDescription resourceDescription) { for (ResourceDescriptionFilter filter : filters) { if (!filter.accept(resourceDescription)) { return false; } } return true; } protected  FederatedResourceDescriptionFilter(ResourceDescriptionFilter... filters); static ResourceDescriptionFilter fromList(List<ResourceDescriptionFilter> inputFilters); @Override boolean accept(ResourceDescription resourceDescription);  }