### Question:
MailboxPath implements Comparable<MailboxPath>, BackendId { public static MailboxPath of(String path) { return new MailboxPath(path, DEFAULT_SEPARATOR); } private  MailboxPath(String path, char separator); static MailboxPath of(String path); static MailboxPath of(String path, char separator); String getPath(); char getSeparator(); Iterable<MailboxPath> reducingPaths(); String stripParentPath(Optional<? extends BackendId> parent); @Override int compareTo(MailboxPath o); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static final char DEFAULT_SEPARATOR; static final int SEPARATOR_LENGTH; }### Answer:
@SuppressWarnings("unchecked") @Test public void ordering() { TreeSet<Comparable<MailboxPath>> set = Sets.newTreeSet(); set.add(MailboxPath.of("custom")); set.add(MailboxPath.of("INBOX")); set.add(MailboxPath.of("Sent/sub/sub/sub")); set.add(MailboxPath.of("Trash")); set.add(MailboxPath.of("Sent")); set.add(MailboxPath.of("Sent/sub")); set.add(MailboxPath.of("Sent/sub/sub")); assertThat(set).containsExactly( MailboxPath.of("custom"), MailboxPath.of("INBOX"), MailboxPath.of("Sent"), MailboxPath.of("Sent/sub"), MailboxPath.of("Sent/sub/sub"), MailboxPath.of("Sent/sub/sub/sub"), MailboxPath.of("Trash") ); }
@Test public void equalShouldNotTakeCareAboutSeparatorWhenNoSeparatorInPath() { assertThat(MailboxPath.of("name", SLASH)) .isEqualTo(MailboxPath.of("name", '.')) .isNotEqualTo(MailboxPath.of("NAME", '.')) .isNotEqualTo(MailboxPath.of("name2", '.')); }
@Test public void equalShouldReturnTrueWhenComparingTwoIdenticPathsWithIdenticSeparators() { assertThat(MailboxPath.of("INBOX/sub", SLASH)).isEqualTo(MailboxPath.of("INBOX/sub", SLASH)); }
@Test public void equalShouldReturnTrueWhenComparingTwoIdenticPathsWithDifferentSeparators() { assertThat(MailboxPath.of("INBOX/sub", SLASH)).isEqualTo(MailboxPath.of("INBOX.sub", '.')); }
@Test public void equalShouldReturnFalseWhenComparingTwoDifferentPathsWithIdenticSeparators() { assertThat(MailboxPath.of("INBOX/sub", SLASH)).isNotEqualTo(MailboxPath.of("INBOX.sub", SLASH)); }
@Test public void equalShouldReturnFalseWhenComparingTwoDifferentPathsWithSameSeparators() { assertThat(MailboxPath.of("INBOX/abcdef", SLASH)).isNotEqualTo(MailboxPath.of("INBOX/sub", SLASH)); }