/** * Note that as of 5.0.3, the creation of the response, which may block * intentionally, is separated from request count tracking, and this * method no longer increments the count transparently. Instead * {@link #incrementAndValidate()} must be invoked independently. */ @Override public ClientHttpResponse createResponse(@Nullable ClientHttpRequest request) throws IOException { ResponseCreator responseCreator = getResponseCreator(); Assert.state(responseCreator != null, "createResponse() called before ResponseCreator was set"); return responseCreator.createResponse(request); }
/** * Note that as of 5.0.3, the creation of the response, which may block * intentionally, is separated from request count tracking, and this * method no longer increments the count transparently. Instead * {@link #incrementAndValidate()} must be invoked independently. */ @Override public ClientHttpResponse createResponse(@Nullable ClientHttpRequest request) throws IOException { ResponseCreator responseCreator = getResponseCreator(); Assert.state(responseCreator != null, "createResponse() called before ResponseCreator was set"); return responseCreator.createResponse(request); }
public ClientHttpResponse execute() throws IOException { if (this.requestMatchers.isEmpty()) { throw new AssertionError("No request expectations to execute"); } if (this.responseCreator == null) { throw new AssertionError("No ResponseCreator was set up. Add it after request expectations, " + "e.g. MockRestServiceServer.expect(requestTo(\"/foo\")).andRespond(withSuccess())"); } for (RequestMatcher requestMatcher : this.requestMatchers) { requestMatcher.match(this); } setResponse(this.responseCreator.createResponse(this)); return super.execute(); }
@Override public ClientHttpResponse createResponse(ClientHttpRequest request) throws IOException { ResponseCreator responseCreator = getResponseCreator(); if (responseCreator == null) { throw new IllegalStateException("createResponse called before ResponseCreator was set"); } getRequestCount().incrementAndValidate(); return responseCreator.createResponse(request); }