@Deprecated public static <T> VoidMethodStubbable<T> stubVoid(final T mock) { return AccessController.doPrivileged(new PrivilegedAction<VoidMethodStubbable<T>>() { @Override public VoidMethodStubbable<T> run() { return org.mockito.Mockito.stubVoid(mock); } }); }
public VoidMethodStubbable<Object> voidMethodStubbable(Object mock) { return null; }
public <T> VoidMethodStubbable<T> stubVoid(T mock) { MockHandlerInterface<T> handler = mockUtil.getMockHandler(mock); mockingProgress.stubbingStarted(); return handler.voidMethodStubbable(mock); }
public VoidMethodStubbable<T> voidMethodStubbable(T mock) { return new VoidMethodStubbableImpl<T>(mock, invocationContainerImpl); }
public VoidMethodStubbable<T> toThrow(Throwable throwable) { invocationContainerImpl.addAnswerForVoidMethod(new ThrowsException(throwable)); return this; }
public VoidMethodStubbable<T> toReturn() { invocationContainerImpl.addAnswerForVoidMethod(new DoesNothing()); return this; }
public VoidMethodStubbable<T> toAnswer(Answer<?> answer) { invocationContainerImpl.addAnswerForVoidMethod(answer); return this; }
public <T> VoidMethodStubbable<T> stubVoid(T mock) { InternalMockHandler<T> handler = mockUtil.getMockHandler(mock); mockingProgress.stubbingStarted(); return handler.voidMethodStubbable(mock); }
public VoidMethodStubbable<T> voidMethodStubbable(T mock) { return mockHandler.voidMethodStubbable(mock); }
public VoidMethodStubbable voidMethodStubbable(Object mock) { return delegate.voidMethodStubbable(mock); }
/** * Delegate call to public static <T> org.mockito.stubbing.VoidMethodStubbable<T> org.mockito.Mockito.stubVoid(T) * {@link org.mockito.Mockito#stubVoid(java.lang.Object)} */ default <T> VoidMethodStubbable<T> stubVoid(T mock) { return Mockito.stubVoid(mock); }
/** * Delegate call to public static <T> org.mockito.stubbing.VoidMethodStubbable<T> org.mockito.Mockito.stubVoid(T) * {@link org.mockito.Mockito#stubVoid(java.lang.Object)} */ default <T> VoidMethodStubbable<T> stubVoid(T mock) { return org.mockito.Mockito.stubVoid(mock); }
/** * <pre> * //Instead of: * stubVoid(mock).toThrow(e).on().someVoidMethod(); * * //Please do: * doThrow(e).when(mock).someVoidMethod(); * </pre> * * doThrow() replaces stubVoid() because of improved readability and consistency with the family of doAnswer() methods. * <p> * Originally, stubVoid() was used for stubbing void methods with exceptions. E.g: * * <pre> * stubVoid(mock).toThrow(new RuntimeException()).on().someMethod(); * * //you can stub with different behavior for consecutive calls. * //Last stubbing (e.g. toReturn()) determines the behavior for further consecutive calls. * stubVoid(mock) * .toThrow(new RuntimeException()) * .toReturn() * .on().someMethod(); * </pre> * * See examples in javadoc for {@link Mockito} class * * @deprecated Use {@link Mockito#doThrow(Throwable)} method for stubbing voids * * @param mock * to stub * @return stubbable object that allows stubbing with throwable */ public static <T> VoidMethodStubbable<T> stubVoid(T mock) { return MOCKITO_CORE.stubVoid(mock); }
VoidMethodStubbable<T> voidMethodStubbable(T mock);