@Test
    void verifySaveAttributeReleasePolicyAllowedAttrRulesAndFilter() {
        getRegisteredServiceTypes().forEach(type -> {
            val registeredService = buildRegisteredServiceInstance(RandomUtils.nextInt(), type)
                .setId(RegisteredServiceDefinition.INITIAL_IDENTIFIER_VALUE);
            registeredService.setAccessStrategy(new DefaultRegisteredServiceAccessStrategy(true, false));

            if (registeredService instanceof final CasRegisteredService casRegisteredService) {
                val policy = new RegexMatchingRegisteredServiceProxyPolicy();
                policy.setPattern("https");
                casRegisteredService.setProxyPolicy(policy);
            }
            registeredService.getAuthenticationPolicy().getRequiredAuthenticationHandlers().addAll(CollectionUtils.wrapHashSet("h1", "h2"));

            val policy = new ReturnAllowedAttributeReleasePolicy();
            policy.setAllowedAttributes(Arrays.asList("1", "2", "3"));
            registeredService.setAttributeReleasePolicy(policy);
            registeredService.getAttributeReleasePolicy().setAttributeFilter(new RegisteredServiceRegexAttributeFilter("\\w+"));

            val r2 = serviceRegistry.save(registeredService);
            val r3 = serviceRegistry.findServiceById(r2.getId());

            assertEquals(r2, r3);
            assertNotNull(r3.getAttributeReleasePolicy());
            assertEquals(r2.getAttributeReleasePolicy(), r3.getAttributeReleasePolicy());
        });
    }
Abstracted service registry tests for all implementations.

@author Timur Duehr
@since 5.3.0
core/cas-server-core-services/src/test/java/org/apereo/cas/services/AbstractServiceRegistryTests.java