### Question:
RepositoryConfigurationComparator implements Comparator<AbstractRepositoryConfiguration> { @Override public int compare( AbstractRepositoryConfiguration o1, AbstractRepositoryConfiguration o2 ) { if ( o1 == null && o2 == null ) { return 0; } if ( o1 == null ) { return -1; } if ( o2 == null ) { return 1; } return o1.getId().compareToIgnoreCase( o2.getId() ); }  @Override int compare( AbstractRepositoryConfiguration o1, AbstractRepositoryConfiguration o2 );  }### Answer:
@Test public void testComparator() { Comparator<AbstractRepositoryConfiguration> comparator = new RepositoryConfigurationComparator(); assertEquals( 0, comparator.compare( null, null ) ); assertEquals( 1, comparator.compare( createRepository( "id" ), null ) ); assertEquals( -1, comparator.compare( null, createRepository( "id" ) ) ); assertEquals( 0, comparator.compare( createRepository( "id1" ), createRepository( "id1" ) ) ); assertEquals( -1, comparator.compare( createRepository( "id1" ), createRepository( "id2" ) ) ); assertEquals( 1, comparator.compare( createRepository( "id2" ), createRepository( "id1" ) ) ); }