@Test
    void verifyDuoSecurityUniversalPromptCredentialFails() throws Throwable {
        val authentication = CoreAuthenticationTestUtils.getAuthentication();
        val duoService = mock(UniversalPromptDuoSecurityAuthenticationService.class);
        when(duoService.authenticate(any(Credential.class)))
            .thenThrow(new FailedLoginException());
        val provider = mock(DuoSecurityMultifactorAuthenticationProvider.class);
        when(provider.getId()).thenReturn(DuoSecurityMultifactorAuthenticationProperties.DEFAULT_IDENTIFIER);
        when(provider.getDuoAuthenticationService()).thenReturn(duoService);

        val handler = getAuthenticationHandler(provider);
        val credential = new DuoSecurityUniversalPromptCredential("token", authentication);
        credential.setProviderId(DuoSecurityMultifactorAuthenticationProperties.DEFAULT_IDENTIFIER);
        assertThrows(FailedLoginException.class, () -> handler.authenticate(credential, mock(Service.class)));
    }
This is {@link DuoSecurityAuthenticationHandlerTests}.

@author Misagh Moayyed
@since 6.2.0
support/cas-server-support-duo-core/src/test/java/org/apereo/cas/adaptors/duo/authn/DuoSecurityAuthenticationHandlerTests.java