@Test
    void verifyRestSendsQueryParametersAndHeaders() throws Throwable {
        try (val webServer = new okhttp3.mockwebserver.MockWebServer()) {
            val port = webServer.getPort();
            val response = new MockResponse().setResponseCode(HttpStatus.ACCEPTED.value());
            webServer.enqueue(response);

            val props = new MultifactorAuthenticationProviderBypassProperties();
            props.getRest().setUrl("http://localhost:" + port);
            props.getRest().setHeaders(Map.of(
                    "X-Custom-Header", "HeaderValue",
                    "Authorization", "Bearer token"
            ));
            val provider = new TestMultifactorAuthenticationProvider();
            val r = new RestMultifactorAuthenticationProviderBypassEvaluator(props, provider.getId(), applicationContext);
            val request = new MockHttpServletRequest();
            val registeredService = MultifactorAuthenticationTestUtils.getRegisteredService();
            val res = r.shouldMultifactorAuthenticationProviderExecute(MultifactorAuthenticationTestUtils.getAuthentication("casuser"),
                    registeredService, provider, request, MultifactorAuthenticationTestUtils.getService("service"));

            val recordedRequest = webServer.takeRequest();
            val recordedRequestUrl = recordedRequest.getRequestUrl();
            assertEquals("casuser", recordedRequestUrl.queryParameter("principal"));
            assertEquals(recordedRequestUrl.queryParameter("service"), registeredService.getServiceId());
            assertEquals(recordedRequestUrl.queryParameter("provider"), provider.getId());
            assertEquals("HeaderValue", recordedRequest.getHeader("X-Custom-Header"));
            assertEquals("Bearer token", recordedRequest.getHeader("Authorization"));
            assertTrue(res);
        }
    }
This is {@link RestMultifactorAuthenticationProviderBypassEvaluatorTests}.

@author Misagh Moayyed
@since 6.0.0
core/cas-server-core-authentication-mfa-api/src/test/java/org/apereo/cas/authentication/RestMultifactorAuthenticationProviderBypassEvaluatorTests.java