@Test
public void testFilter() {

    GenericEntityFilter genericEntityFilter = new GenericEntityFilter();
    FilterConfiguration filterConfiguration = new FilterConfiguration();
    Map<String, Collection<String>> entityFilters = new HashMap<>();
    Collection<String> entityNames = new LinkedList<>();
    entityNames.add(HTTP2_CLIENT_NAME);
    entityFilters.put(genericEntityFilter.getFilterableEntityName(), entityNames);
    filterConfiguration.setEntityFilters(entityFilters);
    List<GenericEntity> filteredEntities = genericEntityFilter.filter("/", filterConfiguration, getTestBundle(), new Bundle());
    assertEquals(1, filteredEntities.size());
    entityFilters.put(genericEntityFilter.getFilterableEntityName(), Collections.emptySet());
    filterConfiguration.setEntityFilters(entityFilters);
    filteredEntities = genericEntityFilter.filter("/", filterConfiguration, getTestBundle(), new Bundle());
    assertEquals(0, filteredEntities.size());
    entityFilters.put(genericEntityFilter.getFilterableEntityName(), ImmutableSet.of("unknownClient"));
    filterConfiguration.setEntityFilters(entityFilters);
    try {
        genericEntityFilter.filter("/", filterConfiguration, getTestBundle(), new Bundle());
        fail("Filter should have failed to validate the required generic entities");
    } catch (EntityFilterException e) {
        assertEquals("Missing Generic Entity(s) with name: 'unknownClient'", e.getMessage());
    }
}