private List<IndexEntry> addPutEntries(List<Long> offsets, long lastEntrySize, IndexSegment segment,
      NavigableMap<MockId, NavigableSet<IndexValue>> referenceIndex, boolean includeSmallKeys, boolean includeLargeKeys)
      throws StoreException {
    List<IndexEntry> addedEntries = new ArrayList<>();
    for (int i = 0; i < offsets.size(); i++) {
      MockId id;
      do {
        if (includeSmallKeys && i % 3 == 1) {
          id = new MockId(TestUtils.getRandomString(CUSTOM_ID_SIZE / 2));
        } else if (includeLargeKeys && i % 3 == 2) {
          id = new MockId(TestUtils.getRandomString(CUSTOM_ID_SIZE + CUSTOM_ID_SIZE / 2));
        } else {
          id = new MockId(TestUtils.getRandomString(CUSTOM_ID_SIZE));
        }
      } while (referenceIndex.containsKey(id));
      long offset = offsets.get(i);
      long size = i == offsets.size() - 1 ? lastEntrySize : offsets.get(i + 1) - offset;
      IndexValue value = IndexValueTest.getIndexValue(size, new Offset(segment.getLogSegmentName(), offset),
          time.milliseconds() + TimeUnit.HOURS.toMillis(1), time.milliseconds(), Utils.getRandomShort(TestUtils.RANDOM),
          Utils.getRandomShort(TestUtils.RANDOM), (short) 0, formatVersion);
      IndexEntry entry = new IndexEntry(id, value);
      segment.addEntry(entry, new Offset(segment.getLogSegmentName(), offset + size));
      addedEntries.add(entry);
      referenceIndex.computeIfAbsent(id, k -> new TreeSet<>()).add(value);
    }
    return addedEntries;
  }
Adds put entries at offsets {@code offsets} into {@code segment}. The {@code offsets} are assumed to be contiguous
with no breaks.
@param offsets the offsets to add the entries at. Difference b/w two entries will be used to compute size.
@param lastEntrySize the size of the last entry in {@code offsets}.
@param segment the {@link IndexSegment} to add the entries to.
@param referenceIndex the {@link NavigableMap} to add all the entries to. This represents the source of truth for
                      all checks.
@param includeSmallKeys if true, entries that are added will include small keys.
@param includeLargeKeys if true, entries that are added will include large keys.
@return {@link List} of {@link IndexEntry}s that were added to the {@link IndexSegment}
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/IndexSegmentTest.java