@Test
public void testLDAPInvalidUsername() {

    String[] usernames = {
            "*", "fu*", "fu*r", "*@myCompany", "fu*@myCompany", "fu*r@myCompany", "*@myCompany.com", "fu*@myCompany.com", "fu*r@myCompany.com",
            "*@.", "*@.myCompany", "fu*@.myCompany", "fu*r@.myCompany", "*@.myCompany.com", "fu*@.myCompany.com", "fu*r@.myCompany.com",
            "fubar.@myCompany.com", "*@.myCompany.", "fu*@.myCompany.", "fu*r@.myCompany.", "*@.myCompany.com.", "fu*@.myCompany.com.",
            "fu*r@.myCompany.com.", "fubar.@myCompany.com.",
        };
    Set<String> failures = new TreeSet<>();
    for (String username : usernames) {
        if (LDAPAuthService._isUsernameValid(username)) {
            failures.add(username);
        }
    }
    assertTrue(failures.toString(), failures.isEmpty());
}