### Question:
EncryptedTransaction implements Serializable { @Override public boolean equals(final Object obj) { return (obj instanceof EncryptedTransaction) && Objects.equals(this.hash, ((EncryptedTransaction) obj).hash); } EncryptedTransaction(final MessageHash hash, final byte[] encodedPayload);  EncryptedTransaction(); @PrePersist void onPersist(); MessageHash getHash(); void setHash(final MessageHash hash); byte[] getEncodedPayload(); void setEncodedPayload(final byte[] encodedPayload); long getTimestamp(); @Override int hashCode(); @Override boolean equals(final Object obj);  }### Answer:
@Test public void subclassesEqual() { class OtherClass extends EncryptedTransaction {} final OtherClass other = new OtherClass(); final EncryptedTransaction et = new EncryptedTransaction(); final boolean equal = Objects.equals(et, other); assertThat(equal).isTrue(); }
@Test public void differentClassesNotEqual() { final Object other = "OTHER"; final EncryptedTransaction et = new EncryptedTransaction(); final boolean equal = Objects.equals(et, other); assertThat(equal).isFalse(); }