@Test
    void serializePublicKeyForServiceAndVerify() {
        getRegisteredServiceTypes().forEach(type -> {
            val publicKey = new RegisteredServicePublicKeyImpl("classpath:RSA1024Public.key", "RSA");
            val registeredService = buildRegisteredServiceInstance(RandomUtils.nextInt(), type)
                .setId(RegisteredServiceDefinition.INITIAL_IDENTIFIER_VALUE);
            registeredService.setPublicKey(publicKey);

            serviceRegistry.save(registeredService);
            serviceRegistry.load();
            assertNotNull(serviceRegistry.findServiceByExactServiceName(registeredService.getName()));
        });
    }
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