@Test
    void verifyOperationDisabledByService() throws Throwable {
        val service = RegisteredServiceTestUtils.getService(UUID.randomUUID().toString());
        val registeredService = RegisteredServiceTestUtils.getRegisteredService(service.getId());
        registeredService.setSurrogatePolicy(new DefaultRegisteredServiceSurrogatePolicy().setEnabled(false));
        servicesManager.save(registeredService);

        assertFalse(surrogateService.isWildcardedAccount(List.of("cassystem"), Optional.of(service)));
        assertFalse(surrogateService.isWildcardedAccount("cassystem", RegisteredServiceTestUtils.getPrincipal(), Optional.of(service)));

        val accounts = surrogateService.getImpersonationAccounts("casuser", Optional.of(service));
        assertTrue(accounts.isEmpty());
        assertFalse(surrogateService.canImpersonate("user3", RegisteredServiceTestUtils.getPrincipal("casuser"), Optional.of(service)));
        assertFalse(surrogateService.canImpersonate("tomhanks", RegisteredServiceTestUtils.getPrincipal("adminuser"), Optional.of(service)));
    }
This is {@link ChainingSurrogateAuthenticationServiceTests}.

@author Misagh Moayyed
@since 7.1.0
support/cas-server-support-surrogate-authentication/src/test/java/org/apereo/cas/authentication/surrogate/ChainingSurrogateAuthenticationServiceTests.java