@GuardedBy("lock")
    private boolean isLeader(ResourceManager<?> resourceManager) {
        return running && this.leaderResourceManager == resourceManager;
    }
@Test
    void revokeLeadership_stopExistLeader() throws Exception {
        final UUID leaderSessionId = UUID.randomUUID();
        final CompletableFuture<UUID> terminateRmFuture = new CompletableFuture<>();

        rmFactoryBuilder.setTerminateConsumer(terminateRmFuture::complete);

        createAndStartResourceManager();

        // grant leadership
        leaderElection.isLeader(leaderSessionId).join();

        // revoke leadership
        leaderElection.notLeader();

        // should terminate RM
        assertThatFuture(terminateRmFuture).eventuallySucceeds().isSameAs(leaderSessionId);
    }