NotFilter extends AbstractFilter { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; NotFilter notFilter = (NotFilter) o; if (filter != null ? !filter.equals(notFilter.filter) : notFilter.filter != null) return false; return true; } NotFilter(Filter filter); StringBuffer encode(StringBuffer buff); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() { EqualsFilter filter = new EqualsFilter("a", "b"); NotFilter originalObject = new NotFilter(filter); NotFilter identicalObject = new NotFilter(filter); NotFilter differentObject = new NotFilter(new EqualsFilter("a", "a")); NotFilter subclassObject = new NotFilter(filter) { }; new EqualsTester(originalObject, identicalObject, differentObject, subclassObject); }