Java 类org.mockito.stubbing.VoidMethodStubbable 实例源码

项目:securemock    文件:Mockito.java   
@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);
        }
    });
}
项目:powermock    文件:PowerMockMaker.java   
public VoidMethodStubbable<Object> voidMethodStubbable(Object mock) {
    return null;
}
项目:astor    文件:MockitoCore.java   
public <T> VoidMethodStubbable<T> stubVoid(T mock) {
    MockHandlerInterface<T> handler = mockUtil.getMockHandler(mock);
    mockingProgress.stubbingStarted();
    return handler.voidMethodStubbable(mock);
}
项目:astor    文件:MockHandler.java   
public VoidMethodStubbable<T> voidMethodStubbable(T mock) {
    return new VoidMethodStubbableImpl<T>(mock, invocationContainerImpl);
}
项目:astor    文件:VoidMethodStubbableImpl.java   
public VoidMethodStubbable<T> toThrow(Throwable throwable) {
    invocationContainerImpl.addAnswerForVoidMethod(new ThrowsException(throwable));
    return this;
}
项目:astor    文件:VoidMethodStubbableImpl.java   
public VoidMethodStubbable<T> toReturn() {
    invocationContainerImpl.addAnswerForVoidMethod(new DoesNothing());
    return this;
}
项目:astor    文件:VoidMethodStubbableImpl.java   
public VoidMethodStubbable<T> toAnswer(Answer<?> answer) {
    invocationContainerImpl.addAnswerForVoidMethod(answer);
    return this;
}
项目:astor    文件:MockitoCore.java   
public <T> VoidMethodStubbable<T> stubVoid(T mock) {
    InternalMockHandler<T> handler = mockUtil.getMockHandler(mock);
    mockingProgress.stubbingStarted();
    return handler.voidMethodStubbable(mock);
}
项目:astor    文件:VoidMethodStubbableImpl.java   
public VoidMethodStubbable<T> toThrow(Throwable throwable) {
    invocationContainerImpl.addAnswerForVoidMethod(new ThrowsException(throwable));
    return this;
}
项目:astor    文件:VoidMethodStubbableImpl.java   
public VoidMethodStubbable<T> toReturn() {
    invocationContainerImpl.addAnswerForVoidMethod(new DoesNothing());
    return this;
}
项目:astor    文件:VoidMethodStubbableImpl.java   
public VoidMethodStubbable<T> toAnswer(Answer<?> answer) {
    invocationContainerImpl.addAnswerForVoidMethod(answer);
    return this;
}
项目:astor    文件:InvocationNotifierHandler.java   
public VoidMethodStubbable<T> voidMethodStubbable(T mock) {
    return mockHandler.voidMethodStubbable(mock);
}
项目:astor    文件:NullResultGuardian.java   
public VoidMethodStubbable voidMethodStubbable(Object mock) {
    return delegate.voidMethodStubbable(mock);
}
项目:astor    文件:MockHandlerImpl.java   
public VoidMethodStubbable<T> voidMethodStubbable(T mock) {
    return new VoidMethodStubbableImpl<T>(mock, invocationContainerImpl);
}
项目:interface-it    文件:MockitoMixinWithSupertype.java   
/**
 * 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);
}
项目:interface-it    文件:Mockito.java   
/**
 * 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);
}
项目:astor    文件:Mockito.java   
/**
 * <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);
}
项目:astor    文件:MockHandlerInterface.java   
VoidMethodStubbable<T> voidMethodStubbable(T mock);
项目:astor    文件:InternalMockHandler.java   
VoidMethodStubbable<T> voidMethodStubbable(T mock);