921922923924925926927
* * @param toBeThrown to be thrown when the stubbed method is called * @return stubber - to select a method for stubbing */ public static Stubber doThrow(Throwable toBeThrown) { return doAnswer(new ThrowsException(toBeThrown)); }
125126127128129130131132
public VoidMethodStubbableImpl(T mock) { this.mock = mock; } public VoidMethodStubbable<T> toThrow(Throwable throwable) { mockitoStubber.addAnswerForVoidMethod(new ThrowsException(throwable)); return this; }
161162163164165166167
} return stubbing; } private NewOngoingStubbing<T> thenThrow(Throwable throwable) { return thenAnswer(new ThrowsException(throwable)); }
184185186187188189190
public DeprecatedOngoingStubbing<T> toReturn(T value) { return toAnswer(new Returns(value)); } public DeprecatedOngoingStubbing<T> toThrow(Throwable throwable) { return toAnswer(new ThrowsException(throwable)); }