public void test_memberAdd_terminateClient() throws InterruptedException {
  final Quorum<?,?> quorum=quorums[0];
  final QuorumMember<?> client=clients[0];
  final QuorumActor<?,?> actor=actors[0];
  final UUID serviceId=client.getServiceId();
  assertFalse(client.isMember());
  assertEquals(new UUID[]{},quorum.getMembers());
  actor.memberAdd();
  fixture.awaitDeque();
  assertTrue(client.isMember());
  assertEquals(new UUID[]{serviceId},quorum.getMembers());
  assertEquals(client,quorum.getClient());
  quorum.terminate();
  try {
    quorum.getClient();
  }
 catch (  IllegalStateException ex) {
    log.info("Ignoring expected exception: " + ex);
  }
  assertEquals(Quorum.NO_QUORUM,quorum.token());
  assertEquals(Quorum.NO_QUORUM,quorum.lastValidToken());
  assertEquals(new UUID[]{},quorum.getMembers());
  assertEquals(new UUID[]{},quorum.getJoined());
  assertEquals(new UUID[]{},quorum.getPipeline());
  assertEquals(Collections.emptyMap(),quorum.getVotes());
  try {
    assertFalse(client.isMember());
  }
 catch (  IllegalStateException ex) {
    log.info("Ignoring expected exception: " + ex);
  }
  quorum.terminate();
}

public void test_memberAdd_terminateClient ( ) throws InterruptedException { final Quorum < ? , ? > quorum = quorums [ 0 ] ; final QuorumMember < ? > client = clients [ 0 ] ; final QuorumActor < ? , ? > actor = actors [ 0 ] ; final UUID serviceId = client . getServiceId ( ) ; assertFalse ( client . isMember ( ) ) ; assertEquals ( new UUID [ ] { } , quorum . getMembers ( ) ) ; actor . memberAdd ( ) ; fixture . awaitDeque ( ) ; assertTrue ( client . isMember ( ) ) ; assertEquals ( new UUID [ ] { serviceId } , quorum . getMembers ( ) ) ; assertEquals ( client , quorum . getClient ( ) ) ; quorum . terminate ( ) ; try { quorum . getClient ( ) ; } catch ( IllegalStateException ex ) { log . info ( "Ignoring expected exception: " + ex ) ; } assertEquals ( Quorum . NO_QUORUM , quorum . token ( ) ) ; assertEquals ( Quorum . NO_QUORUM , quorum . lastValidToken ( ) ) ; assertEquals ( new UUID [ ] { } , quorum . getMembers ( ) ) ; assertEquals ( new UUID [ ] { } , quorum . getJoined ( ) ) ; assertEquals ( new UUID [ ] { } , quorum . getPipeline ( ) ) ; assertEquals ( Collections . emptyMap ( ) , quorum . getVotes ( ) ) ; try { assertFalse ( client . isMember ( ) ) ; } catch ( IllegalStateException ex ) { log . info ( "Ignoring expected exception: " + ex ) ; } quorum . terminate ( ) ; }
unit test for quorum member add followed by the termination of the quorum client . this checks for proper termination of the client , including the clear down of the quorum ' s internal state .
