MockRestServiceServer test for follow-up request after failure

Issue: SPR-16132
This commit is contained in:
Juergen Hoeller
2017-10-30 16:40:20 +01:00
parent 3c07afc5be
commit 295e3b6a99
4 changed files with 58 additions and 42 deletions

View File

@@ -75,16 +75,15 @@ public abstract class AbstractRequestExpectationManager implements RequestExpect
@Override
public ClientHttpResponse validateRequest(ClientHttpRequest request) throws IOException {
List<ClientHttpRequest> requests = this.requests;
synchronized (requests) {
if (requests.isEmpty()) {
synchronized (this.requests) {
if (this.requests.isEmpty()) {
afterExpectationsDeclared();
}
try {
return validateRequestInternal(request);
}
finally {
requests.add(request);
this.requests.add(request);
}
}
}
@@ -97,7 +96,7 @@ public abstract class AbstractRequestExpectationManager implements RequestExpect
}
/**
* Sub-classes must implement the actual validation of the request
* Subclasses must implement the actual validation of the request
* matching to declared expectations.
*/
protected abstract ClientHttpResponse validateRequestInternal(ClientHttpRequest request)