if (httpResponse != null) {
List<Expectation> matchingExpectations = new ArrayList<Expectation>();
HttpResponseMatcher httpResponseMatcher = new HttpResponseMatcher(httpResponse);
for (Expectation expectation : expectations) {
if (httpResponseMatcher.matches(expectation.getHttpResponse(false))) {
matchingExpectations.add(expectation);
}
}
expectations = matchingExpectations.toArray(new Expectation[matchingExpectations.size()]);
}