### Question:
QuorumJournalManager implements JournalManager { @Override public void close() throws IOException { loggers.close(); } QuorumJournalManager(Configuration conf,
      URI uri, NamespaceInfo nsInfo);   QuorumJournalManager(Configuration conf,
      URI uri, NamespaceInfo nsInfo,
      AsyncLogger.Factory loggerFactory); static void checkJournalId(String jid); @Override void format(NamespaceInfo nsInfo); @Override boolean hasSomeData(); @Override EditLogOutputStream startLogSegment(long txId); @Override void finalizeLogSegment(long firstTxId, long lastTxId); @Override void setOutputBufferCapacity(int size); @Override void purgeLogsOlderThan(long minTxIdToKeep); @Override void recoverUnfinalizedSegments(); @Override void close(); @Override void selectInputStreams(Collection<EditLogInputStream> streams,
      long fromTxnId, boolean inProgressOk); @Override String toString();  }### Answer:
@Test public void testNewerVersionOfSegmentWins() throws Exception { setupEdgeCaseOneJnHasSegmentWithAcceptedRecovery(); cluster.getJournalNode(0).stopAndJoin(0); qjm = createSpyingQJM(); try { assertEquals(100, QJMTestUtil.recoverAndReturnLastTxn(qjm)); writeSegment(cluster, qjm, 101, 50, false); } finally { qjm.close(); } cluster.restartJournalNode(0); qjm = createSpyingQJM(); try { assertEquals(150, QJMTestUtil.recoverAndReturnLastTxn(qjm)); } finally { qjm.close(); } }
@Test public void testNewerVersionOfSegmentWins2() throws Exception { setupEdgeCaseOneJnHasSegmentWithAcceptedRecovery(); cluster.getJournalNode(0).stopAndJoin(0); qjm = createSpyingQJM(); try { assertEquals(100, QJMTestUtil.recoverAndReturnLastTxn(qjm)); cluster.restartJournalNode(0); cluster.getJournalNode(1).stopAndJoin(0); writeSegment(cluster, qjm, 101, 50, false); } finally { qjm.close(); } cluster.restartJournalNode(1); cluster.getJournalNode(2).stopAndJoin(0); qjm = createSpyingQJM(); try { assertEquals(150, QJMTestUtil.recoverAndReturnLastTxn(qjm)); } finally { qjm.close(); } }