private void deleteKeyAndVerify(StoreKey key, short expectedLifeVersion) throws StoreException {
    assertFalse("targetKey is already deleted", state.index.findKey(key).isDelete());
    short actualLifeVersion = state.index.findKey(key).getLifeVersion();
    assertEquals("Life version isn't " + expectedLifeVersion + " but " + actualLifeVersion, expectedLifeVersion,
        actualLifeVersion);
    state.appendToLog(DELETE_RECORD_SIZE);
    FileSpan fileSpan = state.log.getFileSpanForMessage(state.index.getCurrentEndOffset(), DELETE_RECORD_SIZE);
    state.index.markAsDeleted(key, fileSpan, System.currentTimeMillis());
    assertFalse("targetKey is undeleted", state.index.findKey(key).isUndelete());
    assertTrue("targetKey is not deleted", state.index.findKey(key).isDelete());
    actualLifeVersion = state.index.findKey(key).getLifeVersion();
    assertEquals("Life version isn't " + expectedLifeVersion + " but " + actualLifeVersion, expectedLifeVersion,
        actualLifeVersion);
  }
Tests and verifies a delete with an expected life version
@param key the {@link StoreKey} to look up
@param expectedLifeVersion the expected lifeVersion
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/IndexTest.java