static void testWithErrorCodes(ServerErrorCode[] serverErrorCodesInOrder, PartitionId partition,
      MockServerLayout serverLayout, RouterErrorCode expectedError, ErrorCodeChecker errorCodeChecker,
      String originatingDcName)
      throws Exception {
    setServerErrorCodes(serverErrorCodesInOrder, partition, serverLayout, originatingDcName);
    errorCodeChecker.testAndAssert(expectedError);
    serverLayout.getMockServers().forEach(MockServer::resetServerErrors);
  }
Test that an operation returns a certain result when each server in a partition returns a certain error code.
@param serverErrorCodesInOrder The error codes to set in the order of the servers returned by
                               {@link PartitionId#getReplicaIds()}. If there are more values in this array than
                               there are servers containing the partition, an exception is thrown. If there are
                               fewer, the rest of the servers are set to {@link ServerErrorCode#NoError}
@param partition The partition contained by the servers to set error codes on.
@param serverLayout A {@link MockServerLayout} that is used to find the {@link MockServer}s to set error codes on.
@param expectedError The {@link RouterErrorCode} expected, or null if no error is expected.
@param errorCodeChecker Performs the checks that ensure that the expected {@link RouterErrorCode} is returned .
@param originatingDcName
@throws Exception
ambry-router/src/test/java/com/github/ambry/router/RouterTestHelpers.java