OpenId { @Override public boolean equals(Object o) { if (o == this) { return true; } else if ((o != null) && o.getClass().equals(getClass())) { OpenId other = (OpenId) o; return new EqualsBuilder() .append(delegateId, other.delegateId) .append(realId, other.realId) .isEquals(); } return false; } OpenId(String delegateId, String realId); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() { assertEqualsContract( new OpenId("delegateId", "realId"), new OpenId("delegateId", "realId"), new OpenId("delegateId", "realId"), new OpenId("delegateId", "differentRealId")); }