### Question:
Message implements Part, Body { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); }  boolean olderThan(Date earliestDate); @Override boolean equals(Object o); @Override int hashCode(); String getUid(); void setUid(String uid); Folder getFolder(); abstract String getSubject(); abstract void setSubject(String subject); Date getInternalDate(); void setInternalDate(Date internalDate); abstract Date getSentDate(); abstract void setSentDate(Date sentDate, boolean hideTimeZone); abstract Address[] getRecipients(RecipientType type); abstract void setRecipients(RecipientType type, Address[] addresses); void setRecipient(RecipientType type, Address address); abstract Address[] getFrom(); abstract void setFrom(Address from); abstract Address[] getSender(); abstract void setSender(Address sender); abstract Address[] getReplyTo(); abstract void setReplyTo(Address[] from); abstract String getMessageId(); abstract void setInReplyTo(String inReplyTo); abstract String[] getReferences(); abstract void setReferences(String references); @Override abstract Body getBody(); @Override abstract void addHeader(String name, String value); @Override abstract void addRawHeader(String name, String raw); @Override abstract void setHeader(String name, String value); @NonNull @Override abstract String[] getHeader(String name); abstract Set<String> getHeaderNames(); @Override abstract void removeHeader(String name); @Override abstract void setBody(Body body); abstract boolean hasAttachments(); abstract long getSize(); void delete(String trashFolderName); Set<Flag> getFlags(); void setFlag(Flag flag, boolean set); void setFlags(final Set<Flag> flags, boolean set); boolean isSet(Flag flag); void destroy(); @Override abstract void setEncoding(String encoding); abstract void setCharset(String charset); long calculateSize(); @Override abstract Message clone();  }### Answer:
@Test public void equals_whenFolderIdDifferent_isFalse() { SimpleFolder folder1 = new SimpleFolder(); folder1.id = "1"; SimpleFolder folder2 = new SimpleFolder(); folder2.id = "2"; String uid = "uid"; Message m1 = new StoredMimeMessage(folder1, uid); Message m2 = new StoredMimeMessage(folder2, uid); boolean result = m1.equals(m2); assertFalse(result); }
@Test public void equals_whenUidDifferent_isFalse() { SimpleFolder folder = new SimpleFolder(); folder.id = "1"; String uid1 = "uid1"; String uid2 = "uid2"; Message m1 = new StoredMimeMessage(folder, uid1); Message m2 = new StoredMimeMessage(folder, uid2); boolean result = m1.equals(m2); assertFalse(result); }
@Test public void equals_whenUidAndFolderSame_isTrue() { SimpleFolder folder1 = new SimpleFolder(); folder1.id = "1"; SimpleFolder folder2 = new SimpleFolder(); folder2.id = "1"; String uid = "uid"; Message m1 = new StoredMimeMessage(folder1, uid); Message m2 = new StoredMimeMessage(folder2, uid); boolean result = m1.equals(m2); assertTrue(result); }