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

        try (val webServer = new MockWebServer(
            new ByteArrayResource(StringUtils.EMPTY.getBytes(StandardCharsets.UTF_8), "REST Output"), MediaType.APPLICATION_JSON_VALUE)) {
            webServer.start();

            val props = new GoogleRecaptchaProperties()
                .setVerifyUrl("http://localhost:%s".formatted(webServer.getPort()));
            val validateAction = new ValidateCaptchaAction(new GoogleCaptchaV2Validator(props), captchaActivationStrategy);

            val result = validateAction.execute(context);
            assertNotNull(result);
            assertEquals(CasWebflowConstants.TRANSITION_ID_CAPTCHA_ERROR, result.getId());
        }
    }
This is {@link ValidateCaptchaActionTests}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-captcha/src/test/java/org/apereo/cas/web/flow/ValidateCaptchaActionTests.java