@Test
    void verifyOperation() throws Throwable {
        val strategy = new OpenPolicyAgentRegisteredServiceAccessStrategy();
        strategy.setApiUrl("http://localhost:8756");
        strategy.setDecision("example/authz/allow");
        strategy.setToken(UUID.randomUUID().toString());
        strategy.setContext(Map.of("Param1", List.of("Value1")));

        val principalAttributes = new HashMap<String, List<Object>>();
        principalAttributes.put("email", List.of("user@example.org"));
        val principal = RegisteredServiceTestUtils.getPrincipal("person", principalAttributes);
        val request = RegisteredServiceAccessStrategyRequest.builder()
            .service(RegisteredServiceTestUtils.getService())
            .principalId(principal.getId())
            .attributes(principal.getAttributes())
            .applicationContext(applicationContext)
            .build();
        assertFalse(strategy.authorizeRequest(request));

        val mapper = JacksonObjectMapperFactory.builder().defaultTypingEnabled(false).build().toObjectMapper();
        val data = mapper.writeValueAsString(CollectionUtils.wrap("result", true));
        try (val webServer = new MockWebServer(8756,
            new ByteArrayResource(data.getBytes(StandardCharsets.UTF_8), "REST Output"), MediaType.APPLICATION_JSON_VALUE)) {
            webServer.start();
            assertTrue(strategy.authorizeRequest(request));
        }
    }
This is {@link OpenPolicyAgentRegisteredServiceAccessStrategyTests}.

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