@Test
    void verifySaveAndLoad() {
        getRegisteredServiceTypes().forEach(type -> {
            serviceRegistry.deleteAll();
            val loadSize = getLoadSize();
            for (var i = 0; i < loadSize; i++) {
                val svc = buildRegisteredServiceInstance(i, type)
                    .setId(RegisteredServiceDefinition.INITIAL_IDENTIFIER_VALUE);
                serviceRegistry.save(svc);

                val svc2 = serviceRegistry.findServiceByExactServiceName(svc.getName());
                assertNotNull(svc2, type::getName);

                val svc3 = serviceRegistry.findServiceById(svc2.getId());
                assertEquals(svc2, svc3);

                serviceRegistry.delete(svc2);
            }
            val results = serviceRegistry.load();
            assertTrue(results.isEmpty());
            assertEquals(0, serviceRegistry.getServicesStream().count());
            assertEquals(0, serviceRegistry.size());
        });
    }
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