@Test
  public void undeleteErrorCasesTest() throws Exception {
    assumeTrue(isLogSegmented);
    // Pick a live key that is not undeleted
    MockId id = null;
    for (MockId liveId : liveKeys) {
      if (!undeletedKeys.contains(liveId)) {
        id = liveId;
        break;
      }
    }
    assertNotNull("Should get a live id that are not undeleted", id);
    verifyUndeleteFailure(id, StoreErrorCodes.IDNotDeleted);

    // id already undeleted
    verifyUndeleteFailure(undeletedKeys.iterator().next(), StoreErrorCodes.IDUndeleted);

    // id already deleted permanently
    verifyUndeleteFailure(deletedAndShouldBeCompactedKeys.iterator().next(), StoreErrorCodes.IDDeletedPermanently);

    // id already expired
    id = put(1, PUT_RECORD_SIZE, time.seconds()).get(0);
    verifyUndeleteFailure(id, StoreErrorCodes.IDNotDeleted);
    delete(id);
    time.sleep(2 * Time.MsPerSec);
    verifyUndeleteFailure(id, StoreErrorCodes.TTLExpired);
  }
Tests error cases for {@link BlobStore#undelete(MessageInfo)}.
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java