### Question:
LdapAuthenticator implements PasswordAuthenticator { @VisibleForTesting static boolean containsSpecialCharacters(String user) { if (WHITESPACE.indexIn(user) == 0 || WHITESPACE.lastIndexIn(user) == user.length() - 1) { return true; } return SPECIAL_CHARACTERS.matchesAnyOf(user); } @Inject  LdapAuthenticator(LdapConfig ldapConfig); @Override Principal createAuthenticatedPrincipal(String user, String password);  }### Answer:
@Test public void testContainsSpecialCharacters() { assertThat(LdapAuthenticator.containsSpecialCharacters("The quick brown fox jumped over the lazy dogs")) .as("English pangram") .isEqualTo(false); assertThat(LdapAuthenticator.containsSpecialCharacters("Pchnąć w tę łódź jeża lub ośm skrzyń fig")) .as("Perfect polish pangram") .isEqualTo(false); assertThat(LdapAuthenticator.containsSpecialCharacters("いろはにほへと ちりぬるを わかよたれそ つねならむ うゐのおくやま けふこえて あさきゆめみし ゑひもせす（ん）")) .as("Japanese hiragana pangram - Iroha") .isEqualTo(false); assertThat(LdapAuthenticator.containsSpecialCharacters("*")) .as("LDAP wildcard") .isEqualTo(true); assertThat(LdapAuthenticator.containsSpecialCharacters(" John Doe")) .as("Beginning with whitespace") .isEqualTo(true); assertThat(LdapAuthenticator.containsSpecialCharacters("John Doe \r")) .as("Ending with whitespace") .isEqualTo(true); assertThat(LdapAuthenticator.containsSpecialCharacters("Hi (This) = is * a \\ test # ç à ô")) .as("Multiple special characters") .isEqualTo(true); assertThat(LdapAuthenticator.containsSpecialCharacters("John\u0000Doe")) .as("NULL character") .isEqualTo(true); assertThat(LdapAuthenticator.containsSpecialCharacters("John Doe <john.doe@company.com>")) .as("Angle brackets") .isEqualTo(true); }