@Test
    void verifyDelegation() {
        val params = new TokenDelegationParameters();

        val handler = new X509TokenDelegationHandler();

        val elementResponse = mock(Element.class);
        when(elementResponse.getLocalName()).thenReturn(WSS4JConstants.X509_DATA_LN);

        val token = mock(ReceivedToken.class);
        when(token.getToken()).thenReturn(elementResponse);
        when(token.getState()).thenReturn(ReceivedToken.STATE.VALID);
        when(token.getPrincipal()).thenReturn(mock(Principal.class));
        when(token.isDOMElement()).thenReturn(Boolean.TRUE);

        params.setToken(token);
        val response = handler.isDelegationAllowed(params);
        assertTrue(response.isDelegationAllowed());
    }
This is {@link X509TokenDelegationHandlerTests}.

@author Misagh Moayyed
@since 6.3.0
support/cas-server-support-ws-sts-api/src/test/java/org/apereo/cas/support/x509/X509TokenDelegationHandlerTests.java