@Test
    void persistCustomServiceProperties() {
        getRegisteredServiceTypes().forEach(type -> {
            val registeredService = buildRegisteredServiceInstance(RandomUtils.nextInt(), type)
                .setId(RegisteredServiceDefinition.INITIAL_IDENTIFIER_VALUE);
            val properties = new HashMap<String, RegisteredServiceProperty>();
            val property = new DefaultRegisteredServiceProperty();
            val values = new HashSet<String>();
            values.add("value1");
            values.add("value2");
            property.setValues(values);
            properties.put("field1", property);

            val property2 = new DefaultRegisteredServiceProperty();
            val values2 = new HashSet<String>();
            values2.add("value12");
            values2.add("value22");
            property2.setValues(values2);
            properties.put("field2", property2);

            registeredService.setProperties(properties);

            serviceRegistry.save(registeredService);
            serviceRegistry.load();
            assertNotNull(serviceRegistry.findServiceByExactServiceName(registeredService.getName()));
            assertEquals(2, registeredService.getProperties().size());
            assertNotNull(registeredService.getProperties().get("field1"));

            val prop = registeredService.getProperties().get("field1");
            assertEquals(2, prop.getValues().size());
            serviceRegistry.delete(registeredService);
        });
    }
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