private void verifyJournal(NavigableMap<MockId, NavigableSet<IndexValue>> referenceIndex, Journal journal) {
    // order all available IndexValue by offset
    final TreeMap<Offset, MockId> allIdsByOffset = new TreeMap<>();
    referenceIndex.forEach(
        (key, value) -> value.forEach(indexValue -> allIdsByOffset.put(indexValue.getOffset(), key)));
    List<JournalEntry> entries = journal.getEntriesSince(allIdsByOffset.firstKey(), true);
    assertEquals("Size of entries returned from journal not as expected", allIdsByOffset.size(), entries.size());
    for (JournalEntry entry : entries) {
      StoreKey key = entry.getKey();
      Offset offset = entry.getOffset();
      assertEquals("Key not as expected", key, allIdsByOffset.get(offset));
    }
  }
Verfies that the journal has all and only expected entries.
@param referenceIndex the index entries to be used as reference.
@param journal the {@link Journal} to check.
ambry-store/src/test/java/com/github/ambry/store/IndexSegmentTest.java