/** * Reset all expectations for this group. */ public void reset() { getExpectations().clear(); } }
/** * Invoke this for an expectation that has been matched. * <p>The given expectation will either be stored if it has a remaining * count or it will be removed otherwise. */ public void update(RequestExpectation expectation) { if (expectation.hasRemainingCount()) { getExpectations().add(expectation); } else { getExpectations().remove(expectation); } }
/** * Return a matching expectation, or {@code null} if none match. */ public RequestExpectation findExpectation(ClientHttpRequest request) throws IOException { for (RequestExpectation expectation : getExpectations()) { try { expectation.match(request); return expectation; } catch (AssertionError error) { // We're looking to find a match or return null.. } } return null; }