### Question:
PublicKey { @Override public int hashCode() { return 22 * getClass().hashCode() + (getId() != null ? getId().hashCode() : 0); } PublicKey(String id, boolean active, Date created, Date expires); String getId(); Boolean isActive(); Date getCreated(); Date getExpires(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void hashCodeIsEqualForSameObject() throws Exception { assertEquals(publicKey.hashCode(), publicKey.hashCode()); }
@Test public void hashCodeIsEqualForSameFingerPrint() throws Exception { assertEquals(publicKey.hashCode(), new PublicKey(fingerprint, !active, null, null).hashCode()); }
@Test public void hashCodeIsNotEqualForDifferentFingerprint() throws Exception { assertNotEquals(publicKey.hashCode(), new PublicKey("Different Fingerprint", active, created, expires).hashCode()); }
@Test public void hashCodeIsNotEqualForFingerprintStringObject() throws Exception { assertNotEquals(publicKey.hashCode(), fingerprint.hashCode()); }