public <T> void reset(T ... mocks) { mockingProgress.validateState(); mockingProgress.reset(); mockingProgress.resetOngoingStubbing(); for (T m : mocks) { mockUtil.resetMock(m); } }
public void reset() { threadSafely().reset(); }
public <T> void reset(T... mocks) { MockingProgress mockingProgress = mockingProgress(); mockingProgress.validateState(); mockingProgress.reset(); mockingProgress.resetOngoingStubbing(); for (T m : mocks) { resetMock(m); } }
public IOngoingStubbing stub() { IOngoingStubbing stubbing = mockingProgress.pullOngoingStubbing(); if (stubbing == null) { mockingProgress.reset(); reporter.missingMethodInvocation(); } return stubbing; }
public <T> void clearInvocations(T... mocks) { MockingProgress mockingProgress = mockingProgress(); mockingProgress.validateState(); mockingProgress.reset(); mockingProgress.resetOngoingStubbing(); for (T m : mocks) { getInvocationContainer(m).clearInvocations(); } }
@Override public Stubber doThrow(Class<? extends Throwable> toBeThrown) { if (toBeThrown == null) { mockingProgress().reset(); throw notAnException(); } Throwable e = null; try { e = newInstance(toBeThrown); } finally { if (e == null) { //this means that an exception or error was thrown when trying to create new instance //we don't want 'catch' statement here because we want the exception to be thrown to the user //however, we do want to clean up state (e.g. "stubbing started"). mockingProgress().reset(); } } return doThrow(e); }
public <T> void reset(T ... mocks) { mockingProgress.validateState(); mockingProgress.reset(); mockingProgress.resetOngoingStubbing(); for (T m : mocks) { mockUtil.resetMock(m); } }
@Override public OngoingStubbing<T> thenThrow(Class<? extends Throwable> throwableType) { if (throwableType == null) { mockingProgress().reset(); throw notAnException(); } return thenThrow(newInstance(throwableType)); }
@Override public Stubber doThrow(Class<? extends Throwable> toBeThrown, Class<? extends Throwable>... nextToBeThrown) { Stubber stubber = doThrow(toBeThrown); if (nextToBeThrown == null) { mockingProgress().reset(); throw notAnException(); } for (Class<? extends Throwable> next : nextToBeThrown) { stubber = stubber.doThrow(next); } return stubber; }
public <T> OngoingStubbing<T> when(T methodCall) { MockingProgress mockingProgress = mockingProgress(); mockingProgress.stubbingStarted(); @SuppressWarnings("unchecked") OngoingStubbing<T> stubbing = (OngoingStubbing<T>) mockingProgress.pullOngoingStubbing(); if (stubbing == null) { mockingProgress.reset(); throw missingMethodInvocation(); } return stubbing; }
public void reset() { threadSafely().reset(); }
public IOngoingStubbing stub() { IOngoingStubbing stubbing = mockingProgress.pullOngoingStubbing(); if (stubbing == null) { mockingProgress.reset(); reporter.missingMethodInvocation(); } return stubbing; }