public java.lang.Object invoke(Invocation invocation) { closeMethod(); List<IArgumentMatcher> lastMatchers = LastControl.pullMatchers(); lastInvocation = new ExpectedInvocation(invocation, lastMatchers); lastInvocationUsed = false; return emptyReturnValueFor(invocation.getMethod().getReturnType()); }
public void replay() { try { state.replay(); state = new ReplayState(behavior); LastControl.reportLastControl(null); } catch (RuntimeExceptionWrapper e) { throw (RuntimeException) e.getRuntimeException().fillInStackTrace(); } }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { if (control.getState() instanceof RecordState) { LastControl.reportLastControl(control); } return control.getState().invoke(new Invocation(proxy, method, args)); } catch (RuntimeExceptionWrapper e) { throw e.getRuntimeException().fillInStackTrace(); } catch (AssertionErrorWrapper e) { throw e.getAssertionError().fillInStackTrace(); } catch (ThrowableWrapper t) { throw t.getThrowable().fillInStackTrace(); } // then let all unwrapped exceptions pass unmodified }
public void replay() { closeMethod(); if (LastControl.pullMatchers() != null) { throw new IllegalStateException("matcher calls were used outside expectations"); } }
public final void reset() { behavior = new MocksBehavior(type == MockType.NICE); behavior.checkOrder(type == MockType.STRICT); state = new RecordState(behavior); LastControl.reportLastControl(null); }