private void undeleteKeyAndVerify(StoreKey targetKey, short expectedLifeVersion, boolean expectTtlUpdateSet)
      throws StoreException {
    assertTrue("targetKey is not deleted", state.index.findKey(targetKey).isDelete());
    assertFalse("targetKey is undeleted early", state.index.findKey(targetKey).isUndelete());
    IndexValue prevValue = state.index.findKey(targetKey);
    assertEquals("Life version isn't " + (expectedLifeVersion - 1) + " but " + prevValue.getLifeVersion(),
        expectedLifeVersion - 1, prevValue.getLifeVersion());
    state.appendToLog(UNDELETE_RECORD_SIZE);
    FileSpan fileSpan = state.log.getFileSpanForMessage(state.index.getCurrentEndOffset(), UNDELETE_RECORD_SIZE);
    long operationTime = state.time.milliseconds();
    state.index.markAsUndeleted(targetKey, fileSpan, operationTime);
    IndexValue value = state.index.findKey(targetKey);
    checkUndelete(value, expectTtlUpdateSet, expectedLifeVersion, ((MockId) targetKey).getAccountId(),
        ((MockId) targetKey).getContainerId(), UNDELETE_RECORD_SIZE, fileSpan.getStartOffset(),
        prevValue.getExpiresAtMs(), operationTime);
  }
Tests and verifies an undelete with an expected life version
@param targetKey the {@link StoreKey} to look up
@param expectedLifeVersion the expected lifeVersion
@param expectTtlUpdateSet true when expecting ttl update flag is set from returned {@link IndexValue}
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/IndexTest.java