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