@Test
    void verifyNoWarningOnMatch() {
        val h = new OptionalWarningLdapAccountStateHandler();
        h.setWarnAttributeName("attribute");
        h.setWarningAttributeValue("value");
        h.setDisplayWarningOnMatch(false);
        val response = mock(AuthenticationResponse.class);
        val entry = mock(LdapEntry.class);
        when(response.getLdapEntry()).thenReturn(entry);
        when(entry.getAttribute(anyString())).thenReturn(new LdapAttribute("attribute", "value"));
        val messages = new ArrayList<MessageDescriptor>();
        val config = new PasswordPolicyContext();
        config.setPasswordWarningNumberOfDays(5);
        h.handleWarning(new AccountState.DefaultWarning(ZonedDateTime.now(ZoneId.systemDefault()), 1),
            response, config, messages);
        assertEquals(0, messages.size());
    }
This is {@link OptionalWarningLdapAccountStateHandlerTests}.

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