### Question:
PublicKey { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof PublicKey)) return false; PublicKey publicKey = (PublicKey) o; return getId() != null ? getId().equals(publicKey.getId()) : publicKey.getId() == null; } 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 equalsIsTrueForSameObject() throws Exception { assertTrue(publicKey.equals(publicKey)); }
@Test public void equalsIsTrueForSameFingerPrint() throws Exception { assertTrue(publicKey.equals(new PublicKey(fingerprint, !active, null, null))); }
@Test public void equalsIsFalseForDifferentFingerprint() throws Exception { assertFalse(publicKey.equals(new PublicKey("Different Fingerprint", active, created, expires))); }
@Test public void equalsIsFalseForFingerprintStringObject() throws Exception { assertFalse(publicKey.equals(fingerprint)); }