@Test
    void verifyRedirectAction() throws Throwable {
        val context = MockRequestContext.create(applicationContext);

        WebUtils.putAuthentication(CoreAuthenticationTestUtils.getAuthentication(), context);
        WebUtils.putServiceIntoFlowScope(context, CoreAuthenticationTestUtils.getWebApplicationService());

        val attributes = new HashMap<String, String>();
        attributes.put(Response.ResponseType.REDIRECT.name().toLowerCase(Locale.ENGLISH), "true");

        val casResponse = mock(Response.class);
        when(casResponse.url()).thenReturn("https://google.com");
        when(casResponse.responseType()).thenReturn(Response.ResponseType.REDIRECT);
        when(casResponse.attributes()).thenReturn(attributes);
        val responseBuilder = mock(ResponseBuilder.class);
        when(responseBuilder.build(any(), any(), any())).thenReturn(casResponse);
        val locator = mock(ResponseBuilderLocator.class);
        when(locator.locate(any(WebApplicationService.class))).thenReturn(responseBuilder);

        val redirectToServiceAction = new InjectResponseHeadersAction(locator);
        val event = redirectToServiceAction.execute(context);
        assertEquals(CasWebflowConstants.TRANSITION_ID_REDIRECT, event.getId());
        assertNotNull(context.getHttpServletResponse().getHeader(CasProtocolConstants.PARAMETER_SERVICE));
    }
This is {@link InjectResponseHeadersActionTests}.

@author Misagh Moayyed
@since 5.3.0
core/cas-server-core-webflow/src/test/java/org/apereo/cas/web/flow/actions/InjectResponseHeadersActionTests.java