@Test
public void testRemoveFilter() {

    Filter results = Filters.removeFilter(null, a);
    assertNull("Start with nothing should end with nothing", results);
    results = Filters.removeFilter(a, null);
    assertSame("Existing should be returned with null target", a, results);
    And base = ff.and(Arrays.asList(new Filter[]{a,b,c}));
    results = Filters.removeFilter(base, d);
    assertEquals("Should not change when target not a child", base, results);
    results = Filters.removeFilter(base, b);
    And expected = ff.and(a, c);
    assertEquals(expected, results);
    //now remove another.  it should be collapsed and only c returned
    results = Filters.removeFilter(results, a);
    assertEquals(results, c);
    //test the last ill-formed bit
    results = Filters.removeFilter(results, c);
    assertSame("Include should be returned when same filter", Filter.INCLUDE, results);
}