LdapBasicAuthenticator implements Authenticator<BasicCredentials, User> { String comprisePrincipal(String sanitizedUsername) { return settings.getPrincipalTemplate().replaceAll("\\$\\{USERNAME\\}", sanitizedUsername); } LdapBasicAuthenticator(LdapConfig settings); Optional<User> authenticate(BasicCredentials credentials);  }
@Test public void testComprisePrincipal() { String username = "my.userNAME_123"; String principal = AUTHENTICATOR_FOR_UTIL_METHODS_WITHOUT_SSL.comprisePrincipal(username); Assert.assertEquals(username+USERNAME_SUFFIX, principal); }