### Question:
HazelcastClusteringService implements ClusteringService { @Override public boolean isLeader() { final Cluster cluster = hz.getCluster(); final Member leader = Iterables.getFirst(cluster.getMembers(), cluster.getLocalMember()); return leader.localMember() && quorum.isQuorum(); }  @Override boolean isLeader(); @Override ClusteredMap<K, V> getMap(final String id); @Override ClusteredQueue<T> getQueue(final String id); @Override ClusteredTopic<T> getReliableTopic(final String id); @Override ClusteredAtomicLong getAtomicLong(final String id); @Override ClusteredLock getLock(final String id);  }### Answer:
@Test public void shouldNotBeLeader() { final ClusteringService service = newService(); when(event.getMembers()).thenReturn(ImmutableSet.of()); listener.memberRemoved(event); assertFalse(service.isLeader()); when(event.getMembers()).thenReturn(ImmutableSet.of(local)); listener.memberAdded(event); assertTrue(service.isLeader()); when(local.localMember()).thenReturn(false); assertFalse(service.isLeader()); when(local.localMember()).thenReturn(true); assertTrue(service.isLeader()); }