### Question:
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); int compare( String telephoneNumber1, String telephoneNumber2 );  }### Answer:
@Test public void testNullTelephoneNumbers() { String tel1 = null; String tel2 = null; assertEquals( 0, comparator.compare( tel1, tel2 ) ); tel2 = "abc"; assertEquals( -1, comparator.compare( tel1, tel2 ) ); String tel3 = null; assertEquals( 1, comparator.compare( tel2, tel3 ) ); }
@Test public void testEmptyTelephoneNumbers() { String tel1 = ""; String tel2 = ""; assertEquals( 0, comparator.compare( tel1, tel2 ) ); tel2 = "abc"; assertTrue( comparator.compare( tel1, tel2 ) < 0 ); String tel3 = ""; assertTrue( comparator.compare( tel2, tel3 ) > 0 ); }
@Test public void testSimpleTelephoneNumbers() { String tel1 = "01 02 03 04 05"; String tel2 = "01 02 03 04 05"; assertEquals( 0, comparator.compare( tel1, tel2 ) ); tel2 = "0102030405"; assertEquals( 0, comparator.compare( tel1, tel2 ) ); }
@Test public void testComplexTelephoneNumbers() { String tel1 = " + 33 1 01-02-03-04-05 "; String tel2 = "+3310102030405"; assertEquals( 0, comparator.compare( tel1, tel2 ) ); tel1 = "1-801-555-1212"; tel2 = "18015551212"; assertEquals( 0, comparator.compare( tel1, tel2 ) ); assertEquals( 0, comparator.compare( "1 801 555 1212", tel1 ) ); assertEquals( 0, comparator.compare( "1 801 555 1212", tel2 ) ); }