@Test
    void testSystemStateSentWhenNodesReplied() throws Exception {
        FleetControllerOptions.Builder builder = defaultOptions()
                .setMinTimeBeforeFirstSystemStateBroadcast(300 * 60 * 1000);
        setUpFleetController(timer, builder);
        setUpVdsNodes(timer, true);

        for (DummyVdsNode node : nodes) {
            node.connect();
        }
        // Marking one node as 'initializing' improves testing of state later on.
        nodes.get(3).setNodeState(State.INITIALIZING);

        final StateWaiter waiter = new StateWaiter(timer);

        fleetController().addSystemStateListener(waiter);
        waiter.waitForState("version:\\d+ distributor:10 storage:10 .1.s:i .1.i:1.0", timeout());
        waitForCompleteCycle();

        final int version = waiter.getCurrentSystemState().getVersion();
        fleetController().waitForNodesHavingSystemStateVersionEqualToOrAbove(version, 20, timeout());

        // The last two versions of the cluster state should be seen (all nodes up,
        // zero out timestate)
        new StateMessageChecker(nodes) {
            @Override
            int expectedMessageCount(final DummyVdsNode node) {
                return 2;
            }
        };
    }
Class for testing states of all nodes. Will fail in constructor with
debug message on non-expected results.
clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java