@Test
    void verifyActiveDirectoryPasswordPolicyWithoutExpiration() {
        val ldap = new Ldap();
        ldap.setLdapUrl("ldap://localhost:10389");
        ldap.setBindDn("cn=Directory Manager");
        ldap.setBindCredential("password");
        ldap.setBaseDn("ou=people,dc=example,dc=org");
        ldap.setSearchFilter("cn=user");
        ldap.setType(AbstractLdapAuthenticationProperties.AuthenticationTypes.AD);
        ldap.setDnFormat("cn=%s,dc=example,dc=org");
        val authenticator = LdapUtils.newLdaptiveAuthenticator(ldap);
        assertNotNull(authenticator);
        val passwordPolicy = new LdapPasswordPolicyProperties()
            .setType(AbstractLdapProperties.LdapType.AD)
            .setPasswordExpirationNumberOfDays(-1);
        val configuration = LdapUtils.createLdapPasswordPolicyConfiguration(
            passwordPolicy, authenticator, ArrayListMultimap.create());
        assertNotNull(configuration);
        val responseHandler = Arrays.stream(authenticator.getResponseHandlers()).findFirst()
            .map(ActiveDirectoryAuthenticationResponseHandler.class::cast)
            .orElseThrow();
        assertNull(responseHandler.getExpirationPeriod());
        assertNotNull(responseHandler.getWarningPeriod());
    }
This is {@link LdapUtilsTests}.

@author Misagh Moayyed
@since 6.2.0
support/cas-server-support-ldap-core/src/test/java/org/apereo/cas/LdapUtilsTests.java