@Override
    public int compareTo(DocumentPath that) {
        return Comparators.lexicographical(Comparator.<String>naturalOrder())
                .compare(this.pathElements, that.pathElements);
    }
@SuppressWarnings("SelfComparison")
    @Test
    public void comparePaths() {
        DocumentPath one = path("root");
        DocumentPath four = path("root.a.b.c.d");
        DocumentPath difFour = path("root.e.c.b.a");
        assertThat(one.compareTo(four), is(lessThan(0)));
        assertThat(four.compareTo(one), is(greaterThan(0)));
        assertThat(difFour.compareTo(four), is(greaterThan(0)));
        assertThat(difFour.compareTo(difFour), is(equalTo(0)));
    }