### Question:
PrincipalComparator implements Comparator< Principal >, Serializable { @Override public int compare( final Principal o1, final Principal o2 ) { final Collator collator = Collator.getInstance(); return collator.compare( o1.getName(), o2.getName() ); }  @Override int compare( final Principal o1, final Principal o2 );  }### Answer:
@Test public void testComparatorOrder() { final Principal p1 = () -> "a"; final Principal p2 = () -> "b"; final PrincipalComparator pc = new PrincipalComparator(); Assertions.assertEquals( -1, pc.compare( p1, p2 ) ); Assertions.assertEquals( 0, pc.compare( p1, p1 ) ); Assertions.assertEquals( 1, pc.compare( p2, p1 ) ); Assertions.assertThrows( NullPointerException.class, () -> pc.compare( null, p1 ) ); Assertions.assertThrows( NullPointerException.class, () -> pc.compare( p1, null ) ); Assertions.assertThrows( NullPointerException.class, () -> pc.compare( null, null ) ); }