public static MessageInfo getMessageInfo(StoreKey id, List<MessageInfo> messageInfos, boolean deleteMsg,
      boolean undeleteMsg, boolean ttlUpdateMsg) {
    MessageInfo toRet = null;
    for (int i = messageInfos.size() - 1; i >= 0; i--) {
      MessageInfo messageInfo = messageInfos.get(i);
      if (messageInfo.getStoreKey().equals(id)) {
        if (deleteMsg && messageInfo.isDeleted()) {
          toRet = messageInfo;
          break;
        } else if (undeleteMsg && messageInfo.isUndeleted()) {
          toRet = messageInfo;
          break;
        } else if (ttlUpdateMsg && !messageInfo.isUndeleted() && !messageInfo.isDeleted()
            && messageInfo.isTtlUpdated()) {
          toRet = messageInfo;
          break;
        } else if (!deleteMsg && !ttlUpdateMsg && !undeleteMsg && !messageInfo.isUndeleted() && !messageInfo.isDeleted()
            && !messageInfo.isTtlUpdated()) {
          toRet = messageInfo;
          break;
        }
      }
    }
    return toRet;
  }
Gets the {@link MessageInfo} for {@code id} if present.
@param id the {@link StoreKey} to look for.
@param messageInfos the {@link MessageInfo} list.
@param deleteMsg {@code true} if delete msg is requested. {@code false} otherwise
@param undeleteMsg {@code true} if undelete msg is requested. {@code false} otherwise
@param ttlUpdateMsg {@code true} if ttl update msg is requested. {@code false} otherwise
@return the delete {@link MessageInfo} if it exists in {@code messageInfos}. {@code null otherwise.}
ambry-replication/src/test/java/com/github/ambry/replication/ReplicationTestHelper.java