### Question:
EmbeddedHaServices extends AbstractNonHaServices { @Override public LeaderElectionService getResourceManagerLeaderElectionService() { return resourceManagerLeaderService.createLeaderElectionService(); } EmbeddedHaServices(Executor executor); @Override LeaderRetrievalService getResourceManagerLeaderRetriever(); @Override LeaderRetrievalService getDispatcherLeaderRetriever(); @Override LeaderElectionService getResourceManagerLeaderElectionService(); @Override LeaderElectionService getDispatcherLeaderElectionService(); @Override LeaderRetrievalService getJobManagerLeaderRetriever(JobID jobID); @Override LeaderRetrievalService getJobManagerLeaderRetriever(JobID jobID, String defaultJobManagerAddress); @Override LeaderRetrievalService getWebMonitorLeaderRetriever(); @Override LeaderElectionService getJobManagerLeaderElectionService(JobID jobID); @Override LeaderElectionService getWebMonitorLeaderElectionService(); @Override void close();  }### Answer:
@Test public void testResourceManagerLeaderElection() throws Exception { LeaderContender leaderContender1 = mock(LeaderContender.class); LeaderContender leaderContender2 = mock(LeaderContender.class); LeaderElectionService leaderElectionService1 = embeddedHaServices.getResourceManagerLeaderElectionService(); LeaderElectionService leaderElectionService2 = embeddedHaServices.getResourceManagerLeaderElectionService(); leaderElectionService1.start(leaderContender1); leaderElectionService2.start(leaderContender2); ArgumentCaptor<UUID> leaderIdArgumentCaptor1 = ArgumentCaptor.forClass(UUID.class); ArgumentCaptor<UUID> leaderIdArgumentCaptor2 = ArgumentCaptor.forClass(UUID.class); verify(leaderContender1, atLeast(0)).grantLeadership(leaderIdArgumentCaptor1.capture()); verify(leaderContender2, atLeast(0)).grantLeadership(leaderIdArgumentCaptor2.capture()); assertTrue(leaderIdArgumentCaptor1.getAllValues().isEmpty() ^ leaderIdArgumentCaptor2.getAllValues().isEmpty()); }