@Test
    public void authentSuccessSingleAttribute() {
        val ldapProfileService =
            new LdapProfileService(connectionFactory, authenticator, LdapServer.SN, LdapServer.BASE_PEOPLE_DN);
        ldapProfileService.setUsernameAttribute(LdapServer.CN);
        val credentials = new UsernamePasswordCredentials(GOOD_USERNAME, PASSWORD);
        ldapProfileService.validate(null, credentials);

        val profile = credentials.getUserProfile();
        assertNotNull(profile);
        assertTrue(profile instanceof LdapProfile);
        UserProfile ldapProfile = (LdapProfile) profile;
        assertEquals(GOOD_USERNAME, ldapProfile.getId());
        assertEquals(1, ldapProfile.getAttributes().size());
        assertEquals(FIRSTNAME_VALUE, ldapProfile.getAttribute(LdapServer.SN));
    }
Tests the {@link LdapProfileService}.

@author Jerome Leleu
@since 1.8.0
pac4j-ldap/src/test/java/org/pac4j/ldap/profile/service/LdapProfileServiceTests.java