private MvcResult executeRequest(final String endpoint,
                                     final HttpServletRequest request,
                                     final MockHttpServletResponse response,
                                     final boolean withBasicAuth,
                                     final int expectedStatus) throws Exception {
        val csrfToken = getCsrfToken(request);
        var builder = post("/cas/" + WebAuthnController.BASE_ENDPOINT_WEBAUTHN + endpoint)
            .session((MockHttpSession) request.getSession());
        val cookies = response.getCookies();
        if (cookies != null && cookies.length > 0) {
            builder = builder.cookie(cookies);
        }
        if (withBasicAuth) {
            builder = builder.with(httpBasic(securityProperties.getUser().getName(),
                securityProperties.getUser().getPassword()));
        }

        return mvc.perform(builder.header("X-CSRF-TOKEN", csrfToken != null ? csrfToken.getToken() : StringUtils.EMPTY))
            .andExpect(status().is(expectedStatus))
            .andReturn();
    }
This is {@link WebAuthnControllerMvcTests}.

@author Misagh Moayyed
@since 7.0.0
support/cas-server-support-webauthn/src/test/java/org/apereo/cas/webauthn/web/WebAuthnControllerMvcTests.java