### Question:
Privilege extends DomainObject implements Comparable<Privilege> { @Override public int compareTo(final Privilege other) { if (other == null) { return -1; } return new CompareToBuilder().append(name, other.getName()).toComparison(); } Privilege();  Privilege(final String name); String getName(); void setName(final String name); @Override String toString(); @Override int compareTo(final Privilege other);  }### Answer:
@Test public void testCompareTo() { final Privilege privilege1 = new Privilege("privilege"); final Privilege privilege2 = new Privilege("privilege"); final Privilege privilege3 = new Privilege("privilegeNotEqual"); assertThat(privilege1.compareTo(privilege2), is(0)); assertThat(privilege2.compareTo(privilege1), is(0)); assertThat(privilege1.compareTo(privilege3) < 0, is(true)); assertThat(privilege1.compareTo(null) < 0, is(true)); }