@Test
    void verifyOperation() {
        val requestId = UUID.randomUUID().toString();
        val strategy = new CerbosRegisteredServiceAccessStrategy();
        strategy.setApiUrl("http://localhost:3592");
        strategy.setActions(List.of("read", "view", "comment"));
        strategy.setKind("leave_request");
        strategy.setRequestId(requestId);
        strategy.setToken(UUID.randomUUID().toString());
        strategy.setRolesAttribute("memberOf");

        val request = RegisteredServiceAccessStrategyRequest.builder()
            .service(RegisteredServiceTestUtils.getService())
            .principalId("casuser")
            .registeredService(RegisteredServiceTestUtils.getRegisteredService())
            .attributes(CoreAuthenticationTestUtils.getAttributes())
            .applicationContext(applicationContext)
            .build();
        assertFalse(strategy.authorizeRequest(request));

        val data = """
            {
            "requestId": "%s",
            "results": [
                {
                "resource": {
                    "Id": "XX125",
                    "kind": "album:object"
                },
                "actions": {
                    "view": "EFFECT_ALLOW",
                    "comment": "EFFECT_ALLOW",
                    "read": "EFFECT_ALLOW"
                }}],
                "cerbosCallId": "1-2-3-4"
            }
            """.formatted(requestId);
        try (val webServer = new MockWebServer(
            new ByteArrayResource(data.getBytes(StandardCharsets.UTF_8), "REST Output"), MediaType.APPLICATION_JSON_VALUE)) {
            webServer.start();
            strategy.setApiUrl("http://localhost:%s".formatted(webServer.getPort()));
            assertTrue(strategy.authorizeRequest(request));
        }
    }
This is {@link CerbosRegisteredServiceAccessStrategyTests}.

@author Misagh Moayyed
@since 7.0.0
core/cas-server-core-services/src/test/java/org/apereo/cas/services/CerbosRegisteredServiceAccessStrategyTests.java