CertificateSourceEntity implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } CertificateSourceEntity other = (CertificateSourceEntity) obj; if (identifier == null) { if (other.identifier != null) { return false; } } else if (!identifier.equals(other.identifier)) { return false; } return true; } CertificateSourceEntity(CertificateToken initialCert); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testEquals() { CertificateSourceEntity cpe1 = new CertificateSourceEntity(c1); CertificateSourceEntity cpe2 = new CertificateSourceEntity(c2); CertificateSourceEntity cpeWrong = new CertificateSourceEntity(wrongCert); assertEquals(cpe1, cpe2); assertNotEquals(cpe1, cpeWrong); }