PresentFilter extends AbstractFilter { public PresentFilter(String attribute) { this.attribute = attribute; } PresentFilter(String attribute); StringBuffer encode(StringBuffer buff); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testPresentFilter() { PresentFilter filter = new PresentFilter("foo"); assertThat(filter.encode()).isEqualTo("(foo=*)"); NotFilter notFilter = new NotFilter(new PresentFilter("foo")); assertThat(notFilter.encode()).isEqualTo("(!(foo=*))"); AndFilter andFilter = new AndFilter(); andFilter.and(new PresentFilter("foo")); andFilter.and(new PresentFilter("bar")); assertThat(andFilter.encode()).isEqualTo("(&(foo=*)(bar=*))"); andFilter = new AndFilter(); andFilter.and(new PresentFilter("foo")); andFilter.and(new NotFilter(new PresentFilter("bar"))); assertThat(andFilter.encode()).isEqualTo("(&(foo=*)(!(bar=*)))"); }