@Test
public void testNewerVersionOfSegmentWins() throws Exception {

  setupEdgeCaseOneJnHasSegmentWithAcceptedRecovery();
  
  // Now start writing again without JN0 present:
  cluster.getJournalNode(0).stopAndJoin(0);
  
  qjm = createSpyingQJM();
  try {
    assertEquals(100, QJMTestUtil.recoverAndReturnLastTxn(qjm));
    
    // Write segment but do not finalize
    writeSegment(cluster, qjm, 101, 50, false);
  } finally {
    qjm.close();
  }
  
  // Now try to recover a new writer, with JN0 present,
  // and ensure that all of the above-written transactions are recovered.
  cluster.restartJournalNode(0);
  qjm = createSpyingQJM();
  try {
    assertEquals(150, QJMTestUtil.recoverAndReturnLastTxn(qjm));
  } finally {
    qjm.close();
  }
}