LeaderService { public void electLeader() { log.debug("Elect a new leader now."); jobNodeStorage.executeInLeader(LeaderNode.LATCH, new LeaderElectionExecutionCallback()); log.debug("Leader election completed."); } LeaderService(final CoordinatorRegistryCenter regCenter, final String jobName); void electLeader(); boolean isLeaderUntilBlock(); boolean isLeader(); boolean hasLeader(); void removeLeader();  }
@Test public void assertElectLeader() { leaderService.electLeader(); verify(jobNodeStorage).executeInLeader(eq("leader/election/latch"), ArgumentMatchers.<LeaderElectionExecutionCallback>any()); }