@Override protected RequestExpectation matchRequest(ClientHttpRequest request) throws IOException { RequestExpectation expectation = this.repeatExpectations.findExpectation(request); if (expectation == null) { if (this.expectationIterator == null || !this.expectationIterator.hasNext()) { throw createUnexpectedRequestError(request); } expectation = this.expectationIterator.next(); expectation.match(request); } this.repeatExpectations.update(expectation); return expectation; }
@Override protected RequestExpectation matchRequest(ClientHttpRequest request) throws IOException { RequestExpectation expectation = this.repeatExpectations.findExpectation(request); if (expectation == null) { if (this.expectationIterator == null || !this.expectationIterator.hasNext()) { throw createUnexpectedRequestError(request); } expectation = this.expectationIterator.next(); expectation.match(request); } this.repeatExpectations.update(expectation); return expectation; }
@Override public ClientHttpResponse validateRequestInternal(ClientHttpRequest request) throws IOException { RequestExpectation expectation = this.repeatExpectations.findExpectation(request); if (expectation == null) { if (!this.expectationIterator.hasNext()) { throw createUnexpectedRequestError(request); } expectation = this.expectationIterator.next(); expectation.match(request); } ClientHttpResponse response = expectation.createResponse(request); this.repeatExpectations.update(expectation); return response; }
/** * Collection variant of {@link #update(RequestExpectation)} that can * be used to insert expectations. */ public void updateAll(Collection<RequestExpectation> expectations) { for (RequestExpectation expectation : expectations) { update(expectation); } }
@Override public RequestExpectation matchRequest(ClientHttpRequest request) throws IOException { RequestExpectation expectation = this.remainingExpectations.findExpectation(request); if (expectation == null) { throw createUnexpectedRequestError(request); } this.remainingExpectations.update(expectation); return expectation; }
@Override public ClientHttpResponse validateRequestInternal(ClientHttpRequest request) throws IOException { RequestExpectation expectation = this.remainingExpectations.findExpectation(request); if (expectation != null) { ClientHttpResponse response = expectation.createResponse(request); this.remainingExpectations.update(expectation); return response; } throw createUnexpectedRequestError(request); }
@Override public RequestExpectation matchRequest(ClientHttpRequest request) throws IOException { RequestExpectation expectation = this.remainingExpectations.findExpectation(request); if (expectation == null) { throw createUnexpectedRequestError(request); } this.remainingExpectations.update(expectation); return expectation; }