NotPresentFilter extends AbstractFilter { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; NotPresentFilter that = (NotPresentFilter) o; if (attribute != null ? !attribute.equals(that.attribute) : that.attribute != null) return false; return true; } NotPresentFilter(String attribute); StringBuffer encode(StringBuffer buff); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() { String attribute = "foo"; NotPresentFilter originalObject = new NotPresentFilter(attribute); NotPresentFilter identicalObject = new NotPresentFilter(attribute); NotPresentFilter differentObject = new NotPresentFilter("bar"); NotPresentFilter subclassObject = new NotPresentFilter(attribute) { }; new EqualsTester(originalObject, identicalObject, differentObject, subclassObject); }