private void doFindKeyWithFileSpanTest(MockId id, EnumSet<PersistentIndex.IndexEntryType> types)
      throws StoreException {
    IndexValue expectedValue = state.getExpectedValue(id, types, null);
    verifyValue(id, state.index.findKey(id, null, types), null, types);
    if (expectedValue == null) {
      // there is no filespan testing required if the given type of entry does not exist
      return;
    }
    FileSpan fileSpanForMessage = state.log.getFileSpanForMessage(expectedValue.getOffset(), expectedValue.getSize());

    // FileSpan that is exactly that of the message
    verifyValue(id, state.index.findKey(id, fileSpanForMessage, types), fileSpanForMessage, types);

    Offset recordOffset = expectedValue.getOffset();
    Offset indexSegmentStartOffset = state.referenceIndex.floorKey(recordOffset);
    Offset lowerSegmentStartOffset = state.referenceIndex.lowerKey(indexSegmentStartOffset);
    Offset higherSegmentStartOffset = state.referenceIndex.higherKey(indexSegmentStartOffset);

    // FileSpan from start offset of message to index end offset
    FileSpan fileSpan = new FileSpan(fileSpanForMessage.getStartOffset(), state.index.getCurrentEndOffset());
    verifyValue(id, state.index.findKey(id, fileSpan, types), fileSpan, types);

    // FileSpan from start offset of index to end offset of message
    fileSpan = new FileSpan(state.index.getStartOffset(), fileSpanForMessage.getEndOffset());
    verifyValue(id, state.index.findKey(id, fileSpan, types), fileSpan, types);

    // FileSpan that includes the message
    Offset startOffset = lowerSegmentStartOffset == null ? indexSegmentStartOffset : lowerSegmentStartOffset;
    Offset endOffset = higherSegmentStartOffset == null ? state.index.getCurrentEndOffset() : higherSegmentStartOffset;
    fileSpan = new FileSpan(startOffset, endOffset);
    verifyValue(id, state.index.findKey(id, fileSpan, types), fileSpan, types);

    if (higherSegmentStartOffset != null) {
      // FileSpan higher than the entry (does not include entry)
      fileSpan = new FileSpan(higherSegmentStartOffset, state.log.getEndOffset());
      assertNull("There should have been no value returned", state.index.findKey(id, fileSpan, types));
    }

    if (lowerSegmentStartOffset != null) {
      // FileSpan lower than the entry (does not include entry)
      fileSpan = new FileSpan(state.index.getStartOffset(), lowerSegmentStartOffset);
      IndexValue valueFromIndex = state.index.findKey(id, fileSpan, types);
      if (expectedValue.getFlags() != IndexValue.FLAGS_DEFAULT_VALUE) {
        assertTrue("The update/delete entry should not be returned",
            valueFromIndex == null || !valueFromIndex.getOffset().equals(expectedValue.getOffset()));
      } else {
        assertNull("There should have been no value returned", valueFromIndex);
      }
    }
  }
Does the test for {@link PersistentIndex#findKey(StoreKey, FileSpan, EnumSet)} with the given {@code id}
@param id the {@link MockId} to do the test for
@param types the types of {@link PersistentIndex.IndexEntryType} to look for. The latest entry matching one of the
             types will be returned
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/IndexTest.java