115116117118119120121122
public VoidMethodStubbableImpl(T mock) { this.mock = mock; } public VoidMethodStubbable<T> toThrow(Throwable throwable) { mockitoStubber.addAnswerForVoidMethod(new ThrowsException(throwable)); return this; }
140141142143144145146
public NewOngoingStubbing<T> thenReturn(Object value) { return thenAnswer(new Returns(value)); } public NewOngoingStubbing<T> thenThrow(Throwable throwable) { return thenAnswer(new ThrowsException(throwable)); }
154155156157158159160
public DeprecatedOngoingStubbing<T> toReturn(Object value) { return toAnswer(new Returns(value)); } public DeprecatedOngoingStubbing<T> toThrow(Throwable throwable) { return toAnswer(new ThrowsException(throwable)); }
170171172173174175176
183184185186187188189
791792793794795796797
* * @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)); }
742743744745746747748
129130131132133134135136
157158159160161162163164
return new ConsecutiveStubbing(); } public OngoingStubbing<T> toThrow(Throwable throwable) { verifyingRecorder.eraseLastInvocation(); mockitoStubber.addAnswer(new ThrowsException(throwable)); return new ConsecutiveStubbing(); }
175176177178179180181182
mockitoStubber.addConsecutiveAnswer(new Returns(value)); return this; } public OngoingStubbing<T> toThrow(Throwable throwable) { mockitoStubber.addConsecutiveAnswer(new ThrowsException(throwable)); return this; }