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