@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=*))))"); }