@Test
    @Order(100)
    void verifyOperationFailsWithError() throws Throwable {
        val context = MockRequestContext.create(applicationContext).withUserAgent().setClientInfo();
        context.setParameter(SamlProtocolConstants.PARAMETER_SAML_RELAY_STATE, "SAML2Client");

        val webContext = new JEEContext(context.getHttpServletRequest(), context.getHttpServletResponse());
        val samlClient = (SAML2Client) identityProviders.findClient("SAML2Client", webContext).orElseThrow();
        samlClient.init();

        val handler = mock(LogoutProcessor.class);
        when(handler.processLogout(any(), any())).thenReturn(new FoundAction("https://google.com"));
        samlClient.setLogoutProcessor(handler);

        val credentialExtractor = mock(CredentialsExtractor.class);
        when(credentialExtractor.extract(any())).thenReturn(Optional.of(mock(SAML2Credentials.class)));
        samlClient.setCredentialsExtractor(credentialExtractor);

        val result = delegatedAuthenticationClientFinishLogoutAction.execute(context);
        assertNull(result);
        assertEquals(HttpStatus.FOUND.value(), context.getHttpServletResponse().getStatus());
        assertEquals("https://google.com", context.getHttpServletResponse().getHeader("Location"));
    }
This is {@link DelegatedAuthenticationClientFinishLogoutActionTests}.

@author Misagh Moayyed
@since 6.4.0
support/cas-server-support-pac4j-saml/src/test/java/org/apereo/cas/web/saml2/DelegatedAuthenticationClientFinishLogoutActionTests.java