@Test
    void verifyActiveDirectoryErrors() {
        val handler = new DefaultLdapAccountStateHandler();

        val response = mock(AuthenticationResponse.class);
        when(response.isSuccess()).thenReturn(false);
        when(response.getDiagnosticMessage()).thenReturn("error data 533");
        assertThrows(AccountDisabledException.class, () -> handler.handle(response, new PasswordPolicyContext()));
        when(response.getDiagnosticMessage()).thenReturn("error data 532");
        assertThrows(CredentialExpiredException.class, () -> handler.handle(response, new PasswordPolicyContext()));
        when(response.getDiagnosticMessage()).thenReturn("error data 530");
        assertThrows(InvalidLoginTimeException.class, () -> handler.handle(response, new PasswordPolicyContext()));
        when(response.getDiagnosticMessage()).thenReturn("error data 701");
        assertThrows(AccountExpiredException.class, () -> handler.handle(response, new PasswordPolicyContext()));
        when(response.getDiagnosticMessage()).thenReturn("error data 773");
        assertThrows(AccountPasswordMustChangeException.class, () -> handler.handle(response, new PasswordPolicyContext()));
        when(response.getDiagnosticMessage()).thenReturn("error data 775");
        assertThrows(AccountLockedException.class, () -> handler.handle(response, new PasswordPolicyContext()));

        when(response.getDiagnosticMessage()).thenReturn("error unknown");
        assertDoesNotThrow(() -> {
            handler.handle(response, new PasswordPolicyContext());
        });
    }
This is {@link DefaultLdapAccountStateHandlerTests}.

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