@Test
  public void undeleteBasicTest() throws StoreException {
    assumeTrue(isLogSegmented && addUndeletes);
    // Get deleted key that hasn't been TTLUpdated
    StoreKey targetKey = null;
    for (StoreKey key : state.deletedKeys) {
      IndexValue value = state.index.findKey(key);
      if (!value.isTtlUpdate() && !state.index.isExpired(value) && state.getExpectedValue((MockId) key, true) != null) {
        targetKey = key;
        break;
      }
    }
    if (targetKey == null) {
      throw new IllegalStateException("Could not find deleted key without TTL Update");
    }
    //Undelete deleted key
    short expectedLifeVersion = 1;
    undeleteKeyAndVerify(targetKey, expectedLifeVersion, false);
    //Delete Key
    deleteKeyAndVerify(targetKey, expectedLifeVersion);
    //Undelete key again
    expectedLifeVersion++;
    undeleteKeyAndVerify(targetKey, expectedLifeVersion, false);
    //TTL Update Key
    ttlUpdateKeyAndVerify(targetKey, expectedLifeVersion);
    //Delete Key again
    deleteKeyAndVerify(targetKey, expectedLifeVersion);
    //Undelete Key again
    expectedLifeVersion++;
    undeleteKeyAndVerify(targetKey, expectedLifeVersion, true);
  }
Tests Undelete basic operation when it's invoked from frontend.
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/IndexTest.java