### Question:
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; } WordComparator( String oid ); int compare( String value, String assertion );  }### Answer:
@Test public void testNullWordss() { assertEquals( 0, comparator.compare( null, null ) ); assertEquals( -1, comparator.compare( null, " abc " ) ); assertEquals( 1, comparator.compare( " abc def ghi ", null ) ); }
@Test public void testEqualsWords() { assertEquals( 0, comparator.compare( "abc", "abc" ) ); assertEquals( 0, comparator.compare( "abc", " abc " ) ); assertEquals( 0, comparator.compare( "abc def ghi", "def" ) ); assertEquals( 0, comparator.compare( "abc def ghi", " def " ) ); assertEquals( 0, comparator.compare( "abc def ghi", "abc" ) ); assertEquals( 0, comparator.compare( "abc def ghi", "ghi" ) ); }
@Test public void testNotEqualsWords() { assertEquals( -1, comparator.compare( "abc", "" ) ); assertEquals( -1, comparator.compare( "abc", "ab" ) ); assertEquals( -1, comparator.compare( "abc", " ab " ) ); assertEquals( -1, comparator.compare( "abc def ghi", "dkf" ) ); assertEquals( -1, comparator.compare( "abc def ghi", " dkf " ) ); assertEquals( -1, comparator.compare( "abc def ghi", "hi" ) ); assertEquals( -1, comparator.compare( "abc def ghi", "e" ) ); }