List<IndexEntry> addPutEntries(int count, long size, long expiresAtMs, short lifeVersion) throws StoreException {
    if (count <= 0) {
      throw new IllegalArgumentException("Number of put entries to add cannot be <= 0");
    }
    List<IndexEntry> indexEntries = new ArrayList<>(count);
    Offset expectedJournalLastOffset = null;
    Offset endOffsetOfPrevMsg = log.getEndOffset();
    for (int i = 0; i < count; i++) {
      byte[] dataWritten = appendToLog(size);
      FileSpan fileSpan = log.getFileSpanForMessage(endOffsetOfPrevMsg, size);
      Offset indexSegmentStartOffset = generateReferenceIndexSegmentStartOffset(fileSpan.getStartOffset());
      if (!referenceIndex.containsKey(indexSegmentStartOffset)) {
        // rollover will occur
        advanceTime(DELAY_BETWEEN_LAST_MODIFIED_TIMES_MS);
        referenceIndex.put(indexSegmentStartOffset, new TreeMap<>());
      }
      MockId id = getUniqueId();
      IndexValue value =
          new IndexValue(size, fileSpan.getStartOffset(), expiresAtMs, time.milliseconds(), id.getAccountId(),
              id.getContainerId());
      if (IndexValue.hasLifeVersion(lifeVersion)) {
        value.setNewLifeVersion(lifeVersion);
      }
      IndexEntry entry = new IndexEntry(id, value);
      indexEntries.add(entry);
      logOrder.put(fileSpan.getStartOffset(), new Pair<>(id, new LogEntry(dataWritten, value)));
      allKeys.computeIfAbsent(id, k -> new TreeSet<>()).add(value);
      referenceIndex.get(indexSegmentStartOffset).computeIfAbsent(id, k -> new TreeSet<>()).add(value);
      if (expiresAtMs != Utils.Infinite_Time && expiresAtMs < time.milliseconds()) {
        expiredKeys.add(id);
      } else {
        liveKeys.add(id);
      }
      index.addToIndex(Collections.singletonList(entry), fileSpan);
      lastModifiedTimesInSecs.put(indexSegmentStartOffset, value.getOperationTimeInMs() / Time.MsPerSec);
      expectedJournalLastOffset = fileSpan.getStartOffset();
      endOffsetOfPrevMsg = fileSpan.getEndOffset();
    }
    assertEquals("End Offset of index not as expected", endOffsetOfPrevMsg, index.getCurrentEndOffset());
    assertEquals("Journal's last offset not as expected", expectedJournalLastOffset, index.journal.getLastOffset());
    return indexEntries;
  }
Adds {@code count} number of put entries each of size {@code size} and that expire at {@code expiresAtMs} to the
index (both real and reference).
@param count the number of PUT entries to add.
@param size the size of each PUT entry.
@param expiresAtMs the time at which each of the PUT entries expires.
@param lifeVersion the lifeVersion of each PUT
@return the list of the added entries.
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/CuratedLogIndexState.java