private static String createLdapEntry(final ConnectionFactory factory) throws Exception {
        val photo = IOUtils.toByteArray(new ClassPathResource("image.jpg").getInputStream());
        val cn = RandomUtils.randomAlphabetic(6).toLowerCase(Locale.ENGLISH);
        val request = AddRequest.builder()
            .attributes(List.of(
                new LdapAttribute("objectclass", "top", "person", "inetOrgPerson"),
                new LdapAttribute("cn", cn),
                new LdapAttribute("jpegPhoto", photo),
                new LdapAttribute("sn", cn)))
            .dn("cn=" + cn + ",ou=People,dc=example,dc=org")
            .build();
        val operation = new AddOperation(factory);
        operation.execute(request);
        return cn;
    }
This is {@link LdapUserGraphicalAuthenticationRepositoryTests}.

@author Misagh Moayyed
@since 6.2.0
support/cas-server-support-gua/src/test/java/org/apereo/cas/gua/impl/LdapUserGraphicalAuthenticationRepositoryTests.java