@Test
    void verifySetInCache() {
        val id = new PublisherIdentifier();
        val appCtx = new StaticApplicationContext();
        appCtx.refresh();
        val serviceRegistry = new InMemoryServiceRegistry(appCtx);
        val stream = casProperties.getServiceRegistry().getStream();
        val mgr = mock(DistributedCacheManager.class);
        val strategy = new DefaultRegisteredServiceReplicationStrategy(mgr, stream, id);
        when(mgr.find(any())).thenReturn(Optional.empty());
        var svc = strategy.getRegisteredServiceFromCacheIfAny(newService("Test"), 1000, serviceRegistry);
        assertNotNull(svc);
        svc = strategy.getRegisteredServiceFromCacheIfAny(newService("Test"), "https://example.org", serviceRegistry);
        assertNotNull(svc);
        strategy.destroy();
    }
This is {@link DefaultRegisteredServiceReplicationStrategyTests}.

@author Misagh Moayyed
@since 6.2.0
core/cas-server-core-services-registry/src/test/java/org/apereo/cas/services/replication/DefaultRegisteredServiceReplicationStrategyTests.java