@Test
    void synchronous_task_immediately_failed_when_leadership_lost() throws Exception {
        FleetControllerOptions.Builder options = optionsWithZeroTransitionTime();
        options.setCount(3);
        RemoteTaskFixture fixture = createFixtureWith(options);

        fixture.winLeadership();
        markAllNodesAsUp(options.build());

        MockTask task = fixture.scheduleVersionDependentTaskWithSideEffects();

        assertTrue(task.isInvoked());
        assertFalse(task.isCompleted());

        communicator.setShouldDeferDistributorClusterStateAcks(true);
        fixture.processScheduledTask();
        assertFalse(task.isCompleted());
        assertFalse(task.isLeadershipLost());

        fixture.loseLeadership();

        assertTrue(task.isCompleted());
        assertTrue(task.isLeadershipLost());
    }
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