/** * Fails the test if there are any expectations that have not been met. */ public void assertIsSatisfied() { if (firstError != null) { throw firstError; } else if (!dispatcher.isSatisfied()) { throw expectationErrorTranslator.translate( ExpectationError.notAllSatisfied(this)); } }
private Object dispatch(Invocation invocation) throws Throwable { if (firstError != null) { throw firstError; } try { Object result = dispatcher.dispatch(invocation); actualInvocations.add(invocation); return result; } catch (ExpectationError e) { firstError = expectationErrorTranslator.translate(mismatchDescribing(e)); firstError.setStackTrace(e.getStackTrace()); throw firstError; } catch (Throwable t) { actualInvocations.add(invocation); throw t; } }