private void addEntryAndVerify(Journal journal, Offset offset, MockId id, List<JournalEntry> journalEntries) {
    long crc = Utils.getRandomLong(TestUtils.RANDOM, Long.MAX_VALUE);
    journal.addEntry(offset, id, crc);
    if (journalEntries != null) {
      if (!journal.isInBootstrapMode() && journalEntries.size() >= journal.getMaxEntriesToJournal()) {
        journalEntries.remove(0);
      }
      journalEntries.add(new JournalEntry(offset, id));
    }
    Assert.assertEquals("Unexpected key at offset", id, journal.getKeyAtOffset(offset));
    Assert.assertEquals("Unexpected crc for key", crc, journal.getCrcOfKey(id).longValue());
  }
Adds an entry to the journal and verifies some getters
@param journal the {@link Journal} to add to
@param offset the {@link Offset} to add an entry for
@param id the {@link StoreKey}  at {@code offset}
@param journalEntries a list of {@link JournalEntry} to track entries in current journal. This is for verification
                      purpose.
ambry-store/src/test/java/com/github/ambry/store/JournalTest.java