@Test
    void verifyAuthenticateWarnings() {
        assertNotEquals(0, ldapAuthenticationHandlers.size());

        ldapAuthenticationHandlers.toList().forEach(Unchecked.consumer(h -> {
            val credential = new UsernamePasswordCredential(getUsername(), getSuccessPassword());
            val result = h.authenticate(credential, mock(Service.class));
            assertTrue(result.getWarnings() != null && !result.getWarnings().isEmpty());
            assertTrue(result.getWarnings().stream()
                .anyMatch(messageDescriptor -> "password.expiration.warning".equals(messageDescriptor.getCode())));
            assertNotNull(result.getPrincipal());
            assertEquals(credential.getUsername(), result.getPrincipal().getId());
            val attributes = result.getPrincipal().getAttributes();
            Arrays.stream(getPrincipalAttributes()).forEach(s -> assertTrue(attributes.containsKey(s)));
        }));
    }
Unit test for {@link LdapAuthenticationHandler}.
This test demonstrates password policy for AD by using user which soon to expire password.
@author Hal Deadman
@since 6.1.0
support/cas-server-support-ldap/src/test/java/org/apereo/cas/authentication/ActiveDirectoryLdapAuthenticationHandlerPasswordPolicyTests.java