NotFilter extends AbstractFilter { public StringBuffer encode(StringBuffer buff) { buff.append("(!"); filter.encode(buff); buff.append(')'); return buff; } NotFilter(Filter filter); StringBuffer encode(StringBuffer buff); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testConstructor() { EqualsFilter filter = new EqualsFilter("a", "b"); NotFilter notFilter = new NotFilter(filter); assertThat(notFilter.encode()).isEqualTo("(!(a=b))"); }