/** Reproduce the journal and check if the state is correct. */
  private void reproduceAndCheckState(int successFiles) throws Exception {
    FileSystemMaster fsMaster = createFsMasterFromJournal();

    int actualFiles = fsMaster.getFileInfoList(new TachyonURI(TEST_FILE_DIR)).size();
    Assert.assertTrue((successFiles == actualFiles) || (successFiles + 1 == actualFiles));
    for (int f = 0; f < successFiles; f++) {
      Assert.assertTrue(
          fsMaster.getFileId(new TachyonURI(TEST_FILE_DIR + f)) != IdUtils.INVALID_FILE_ID);
    }
    fsMaster.stop();
  }