@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());
}