static void testWithErrorCodes(ServerErrorCode[] serverErrorCodesInOrder, MockServerLayout serverLayout,
      RouterErrorCode expectedError, ErrorCodeChecker errorCodeChecker) throws Exception {
    setServerErrorCodes(Arrays.asList(serverErrorCodesInOrder), serverLayout);
    errorCodeChecker.testAndAssert(expectedError);
    serverLayout.getMockServers().forEach(MockServer::resetServerErrors);
  }
Test that an operation returns a certain result when each server in the layout returns a certain error code.
@param serverErrorCodesInOrder The error codes to set in the order of the servers in {@code serverLayout}.  If
                               there are more values in this array than there are servers, an exception is thrown.
                               If there are fewer, the rest of the servers are set to
                               {@link ServerErrorCode#NoError}
@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 .
@throws Exception
ambry-router/src/test/java/com/github/ambry/router/RouterTestHelpers.java