@Override
    @Test
    void verifyProxying() throws Throwable {
        var data = MAPPER.writeValueAsString(CollectionUtils.wrapList("casuser", "otheruser"));
        try (val webServer = new MockWebServer(data)) {
            webServer.start();

            val props = new CasConfigurationProperties();
            props.getAuthn().getSurrogate().getRest().setUrl("http://localhost:%s".formatted(webServer.getPort()));
            val surrogateService = new SurrogateRestAuthenticationService(servicesManager, props, principalAccessStrategyEnforcer, applicationContext);

            val application = CoreAuthenticationTestUtils.getService(UUID.randomUUID().toString());
            val registeredService = RegisteredServiceTestUtils.getRegisteredService(application.getId(), Map.of());
            servicesManager.save(registeredService);
            
            val result = surrogateService.canImpersonate("cassurrogate",
                CoreAuthenticationTestUtils.getPrincipal("casuser"),
                Optional.of(application));
            /*
             * Can't use super() until the REST classes are
             * completely refactored and don't need an actual server to connect to.
             */
            assertTrue(result);
        }
    }
This is {@link SurrogateRestAuthenticationServiceTests}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-surrogate-authentication-rest/src/test/java/org/apereo/cas/authentication/surrogate/SurrogateRestAuthenticationServiceTests.java