@Test
    void verifyMissingFlowConversation() {
        val mockFilter = new ResponseHeadersEnforcementFilter() {
            @Override
            protected Optional<RegisteredService> prepareFilterBeforeExecution(final HttpServletResponse httpServletResponse, final HttpServletRequest httpServletRequest) {
                throw new RuntimeException(new IllegalArgumentException(new NoSuchConversationException(new SimpleConversationId(UUID.randomUUID().toString()))));
            }
        };
        val servletRequest = new MockHttpServletRequest();
        val servletResponse = new MockHttpServletResponse();
        assertThrows(NoSuchConversationException.class, () -> mockFilter.doFilter(servletRequest, servletResponse, new MockFilterChain()));
        assertNotNull(servletRequest.getAttribute(RequestDispatcher.ERROR_EXCEPTION));
    }
This is {@link ResponseHeadersEnforcementFilterTests}.

@author Misagh Moayyed
@since 6.2.0
core/cas-server-core-web-api/src/test/java/org/apereo/cas/web/support/filters/ResponseHeadersEnforcementFilterTests.java