private Response sendAndVerifyOperationRequest(RequestOrResponse request, ServerErrorCode expectedErrorCode,
      Boolean forceCheckOpReceived) throws InterruptedException, IOException {
    storageManager.resetStore();
    RequestOrResponseType requestType = request.getRequestType();
    Response response = sendRequestGetResponse(request,
        EnumSet.of(RequestOrResponseType.GetRequest, RequestOrResponseType.ReplicaMetadataRequest).contains(requestType)
            ? ServerErrorCode.NoError : expectedErrorCode);
    if (expectedErrorCode.equals(ServerErrorCode.NoError) || (forceCheckOpReceived && !expectedErrorCode.equals(
        ServerErrorCode.TemporarilyDisabled))) {
      assertEquals("Operation received at the store not as expected", requestType,
          MockStorageManager.operationReceived);
    }
    if (requestType == RequestOrResponseType.GetRequest) {
      GetResponse getResponse = (GetResponse) response;
      for (PartitionResponseInfo info : getResponse.getPartitionResponseInfoList()) {
        assertEquals("Error code does not match expected", expectedErrorCode, info.getErrorCode());
      }
    } else if (requestType == RequestOrResponseType.ReplicaMetadataRequest) {
      ReplicaMetadataResponse replicaMetadataResponse = (ReplicaMetadataResponse) response;
      for (ReplicaMetadataResponseInfo info : replicaMetadataResponse.getReplicaMetadataResponseInfoList()) {
        assertEquals("Error code does not match expected", expectedErrorCode, info.getError());
      }
    }
    return response;
  }
Sends and verifies that an operation specific request works correctly.
@param request the {@link NetworkRequest} to send to {@link AmbryRequests}
@param expectedErrorCode the {@link ServerErrorCode} expected in the response. For some requests this is the
                         response in the constituents rather than the actual response ({@link GetResponse} and
                         {@link ReplicaMetadataResponse}).
@param forceCheckOpReceived if {@code true}, checks the operation received at the {@link Store} even if
                            there is an error expected. Always checks op received if {@code expectedErrorCode} is
                            {@link ServerErrorCode#NoError}. Skips the check otherwise.
@throws InterruptedException
@throws IOException
@return the response associated with given request.
ambry-server/src/test/java/com/github/ambry/server/AmbryServerRequestsTest.java