@Test
    void verifyDynamicCloud() {
        val props = new CasConfigurationProperties();
        props.getServer().getTomcat().getClustering()
            .setEnabled(true).setClusteringType("CLOUD");

        val factory = new CasTomcatServletWebServerFactory(props, serverProperties);

        val tomcat = mock(Tomcat.class);
        when(tomcat.getEngine()).thenReturn(mock(Engine.class));
        val service = mock(Service.class);
        when(service.findConnectors()).thenReturn(new Connector[]{});

        val server = mock(Server.class);
        when(server.findServices()).thenReturn(new Service[]{service});

        val host = mock(Host.class);
        val context = mock(Context.class);
        when(context.getBaseName()).thenReturn("cas");
        when(context.getState()).thenReturn(LifecycleState.STARTED);
        when(host.findChildren()).thenReturn(new Container[]{context});

        when(tomcat.getHost()).thenReturn(host);
        when(tomcat.getService()).thenReturn(service);
        when(tomcat.getServer()).thenReturn(server);

        assertDoesNotThrow(() -> {
            factory.getTomcatWebServer(tomcat);
        });
    }
This is {@link CasTomcatServletWebServerFactoryCloudClusterTests}.

@author Hal Deadman
@since 6.2.0
webapp/cas-server-webapp-init-tomcat/src/test/java/org/apereo/cas/tomcat/CasTomcatServletWebServerFactoryCloudClusterTests.java