@Test
    void verifySaveAttributeReleasePolicyMappingRules() {
        getRegisteredServiceTypes().forEach(type -> {
            val r = buildRegisteredServiceInstance(RandomUtils.nextInt(), type)
                .setId(RegisteredServiceDefinition.INITIAL_IDENTIFIER_VALUE);
            val map = ArrayListMultimap.<String, Object>create();
            map.put("attr1", "newattr1");
            map.put("attr2", "newattr2");
            map.put("attr2", "newattr3");

            val policy = new ReturnMappedAttributeReleasePolicy();
            policy.setAllowedAttributes(CollectionUtils.wrap(map));
            r.setAttributeReleasePolicy(policy);

            val r2 = serviceRegistry.save(r);
            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