@Test
    void verifyServiceLookupByServiceId() {
        getRegisteredServiceTypes().forEach(type -> {
            val r1 = buildRegisteredServiceInstance(RandomUtils.nextInt(), type)
                .setId(RegisteredServiceDefinition.INITIAL_IDENTIFIER_VALUE);
            val id = UUID.randomUUID().toString();
            r1.setServiceId(".*%s.*".formatted(id));
            r1.setEvaluationOrder(100);
            serviceRegistry.save(r1);

            val r2 = buildRegisteredServiceInstance(RandomUtils.nextInt(), type)
                .setId(RegisteredServiceDefinition.INITIAL_IDENTIFIER_VALUE);
            r2.setServiceId(r1.getServiceId());
            r2.setEvaluationOrder(1);
            serviceRegistry.save(r2);
            val svc = serviceRegistry.findServiceBy(id);
            assertNotNull(svc);
            assertEquals(r2, svc);
            assertNull(serviceRegistry.findServiceBy("this-service-id-does-not-exist"));
        });
    }
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