@Test
 public void testBasic() {
   m_coordinator.startRejoin();
   RejoinMessage msg = new RejoinMessage(1000, RejoinMessage.Type.INITIATION);
   verifySent(1l, msg);
   verify(m_volt, never()).onExecutionSiteRejoinCompletion(anyLong());
 }
  @Test
  public void testReplayFinishedBeforeSnapshot() {
    m_coordinator.startRejoin();

    // fake a replay finished response for site 2 before snapshot stream finishes
    RejoinMessage msg3 = new RejoinMessage(2l, RejoinMessage.Type.REPLAY_FINISHED);
    boolean threw = false;
    try {
      m_coordinator.deliver(msg3);
    } catch (AssertionError ae) {
      threw = true;
    }
    assertTrue(threw);
    // crash should be called
    assertTrue(VoltDB.wasCrashCalled);
  }
  @After
  public void tearDown() throws IOException {
    m_coordinator.close();
    VoltFile.recursivelyDelete(m_overflow);

    m_coordinator = null;
    reset(m_volt);
    VoltDB.wasCrashCalled = false;
  }
  @Test
  public void testFinish() {
    testSwitchToNextSite();

    // fake a replay finished response for site 1
    RejoinMessage msg1 = new RejoinMessage(1l, RejoinMessage.Type.REPLAY_FINISHED);
    m_coordinator.deliver(msg1);

    // fake a snapshot finished response for site 2
    RejoinMessage msg2 = new RejoinMessage(2l, RejoinMessage.Type.SNAPSHOT_FINISHED);
    m_coordinator.deliver(msg2);

    // fake a replay finished response for site 2
    RejoinMessage msg3 = new RejoinMessage(2l, RejoinMessage.Type.REPLAY_FINISHED);
    m_coordinator.deliver(msg3);

    verify(m_volt).onExecutionSiteRejoinCompletion(anyLong());
  }
  @Test
  public void testSwitchToNextSite() {
    testBasic();
    reset(m_coordinator);

    // fake response
    RejoinMessage msg = new RejoinMessage(1l, RejoinMessage.Type.SNAPSHOT_FINISHED);
    m_coordinator.deliver(msg);

    // verify the second site is started
    RejoinMessage expected = new RejoinMessage(1000, RejoinMessage.Type.INITIATION);
    verifySent(2l, expected);

    verify(m_volt, never()).onExecutionSiteRejoinCompletion(anyLong());
  }