@Override
    public boolean isLeader() {
        return isLeader;
    }
@Test
    void handlesConsistentFailure() {
        Lock lock = mock(Lock.class);
        when(lockService.lock(any(), isNull()))
                .thenReturn(Optional.of(lock))
                .thenThrow(new RuntimeException("ouch"));

        leaderElectionService.startAsync().awaitRunning();
        verify(eventBus, timeout(10_000).times(2)).post(any(LeaderChangedEvent.class));
        assertThat(leaderElectionService.isLeader()).isFalse();
    }