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