private void addEntriesAndAssert(List<IndexEntry> indexEntries, int keySize, int numEntriesToAdd,
      int expectedSegmentCount, int latestSegmentExpectedEntrySize, boolean createV0IndexValue)
      throws IOException, StoreException {
    Offset currentEndOffset = state.index.getCurrentEndOffset();
    indexEntries.addAll(addPutEntries(currentEndOffset, null, numEntriesToAdd, CuratedLogIndexState.PUT_RECORD_SIZE,
        Utils.Infinite_Time, keySize, createV0IndexValue));
    assertEquals("Unexpected index segment count", expectedSegmentCount, state.index.getIndexSegments().size());
    assertEquals(latestSegmentExpectedEntrySize,
        state.index.getIndexSegments().lastEntry().getValue().getPersistedEntrySize());
  }
Adds entries to the index and asserts that the number of index segments and the persistedEntrySizes of the latest
segment are as expected.
@param indexEntries the list of {@link IndexEntry} to fill with the entries that are added to the index
                    (used for verification by the caller)
@param keySize the length of the ids used within the keys that are to be created for the entries.
@param numEntriesToAdd the number of entries to be added.
@param expectedSegmentCount the expected number of index segments after the entries are added.
@param latestSegmentExpectedEntrySize the expected persistedEntrySize of the latest segment after the entries are
                                      added.
@param createV0IndexValue if true, create {@link IndexValue} in V0.
@throws IOException
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/IndexTest.java