/** * Invoke this for an expectation that has been matched. * <p>The count of the given expectation is incremented, then it is * either stored if remainingCount > 0 or removed otherwise. */ public void update(RequestExpectation expectation) { expectation.incrementAndValidate(); updateInternal(expectation); }
@Test public void isSatisfied() { RequestExpectation expectation = new DefaultRequestExpectation(twice(), requestTo("/foo")); expectation.andRespond(withSuccess()); expectation.incrementAndValidate(); assertFalse(expectation.isSatisfied()); expectation.incrementAndValidate(); assertTrue(expectation.isSatisfied()); }
@Test public void hasRemainingCount() { RequestExpectation expectation = new DefaultRequestExpectation(twice(), requestTo("/foo")); expectation.andRespond(withSuccess()); expectation.incrementAndValidate(); assertTrue(expectation.hasRemainingCount()); expectation.incrementAndValidate(); assertFalse(expectation.hasRemainingCount()); }
/** * Invoke this for an expectation that has been matched. * <p>The count of the given expectation is incremented, then it is * either stored if remainingCount > 0 or removed otherwise. */ public void update(RequestExpectation expectation) { expectation.incrementAndValidate(); updateInternal(expectation); }