public interface PowerMockitoStubber
extends org.mockito.stubbing.Stubber
Modifier and Type | Method and Description |
---|---|
void |
when(java.lang.Class<?> classMock)
Allows to choose a static method when stubbing in
doThrow()|doAnswer()|doNothing()|doReturn() style
|
<T> PrivatelyExpectedArguments |
when(java.lang.Class<T> classMock,
java.lang.reflect.Method method)
Allows to mock a static private method when stubbing in
doThrow()|doAnswer()|doNothing()|doReturn() style.
|
<T> void |
when(java.lang.Class<T> classMock,
java.lang.Object... arguments)
Allows to mock a static private method based on the parameters when
stubbing in doThrow()|doAnswer()|doNothing()|doReturn() style.
|
<T> void |
when(java.lang.Class<T> classMock,
java.lang.String methodToExpect,
java.lang.Object... parameters)
Allows to mock a static private method based on method name and
parameters when stubbing in doThrow()|doAnswer()|doNothing()|doReturn()
style.
|
<T> PrivatelyExpectedArguments |
when(T mock,
java.lang.reflect.Method method)
Allows to mock a private instance method when stubbing in
doThrow()|doAnswer()|doNothing()|doReturn() style.
|
<T> void |
when(T mock,
java.lang.Object... arguments)
Allows to mock a private instance method based on the parameters when
stubbing in doThrow()|doAnswer()|doNothing()|doReturn() style.
|
<T> void |
when(T mock,
java.lang.String methodToExpect,
java.lang.Object... arguments)
Allows to mock a private instance method based on method name and
parameters when stubbing in doThrow()|doAnswer()|doNothing()|doReturn()
style.
|
void when(java.lang.Class<?> classMock)
Example:
doThrow(new RuntimeException()).when(StaticList.class); StaticList.clear(); //following throws RuntimeException: StaticList.clear();Read more about those methods:
Mockito.doThrow(Throwable)
Mockito.doAnswer(Answer)
Mockito.doNothing()
Mockito.doReturn(Object)
See examples in javadoc for Mockito
<T> PrivatelyExpectedArguments when(T mock, java.lang.reflect.Method method) throws java.lang.Exception
Example:
doThrow(new RuntimeException()).when(instance, method("myMethod")).withNoArguments();Read more about those methods:
Mockito.doThrow(Throwable)
Mockito.doAnswer(Answer)
Mockito.doNothing()
Mockito.doReturn(Object)
See examples in javadoc for Mockito
java.lang.Exception
<T> void when(T mock, java.lang.Object... arguments) throws java.lang.Exception
Example:
doThrow(new RuntimeException()).when(instance, parameter1, parameter2);Read more about those methods:
Mockito.doThrow(Throwable)
Mockito.doAnswer(Answer)
Mockito.doNothing()
Mockito.doReturn(Object)
See examples in javadoc for Mockito
java.lang.Exception
<T> void when(T mock, java.lang.String methodToExpect, java.lang.Object... arguments) throws java.lang.Exception
Example:
doThrow(new RuntimeException()).when(instance, "methodName", parameter1, parameter2);Read more about those methods:
Mockito.doThrow(Throwable)
Mockito.doAnswer(Answer)
Mockito.doNothing()
Mockito.doReturn(Object)
See examples in javadoc for Mockito
java.lang.Exception
<T> PrivatelyExpectedArguments when(java.lang.Class<T> classMock, java.lang.reflect.Method method) throws java.lang.Exception
Example:
doThrow(new RuntimeException()).when(MyClass.class, method("myMethod")).withNoArguments();Read more about those methods:
Mockito.doThrow(Throwable)
Mockito.doAnswer(Answer)
Mockito.doNothing()
Mockito.doReturn(Object)
See examples in javadoc for Mockito
java.lang.Exception
<T> void when(java.lang.Class<T> classMock, java.lang.Object... arguments) throws java.lang.Exception
Example:
doThrow(new RuntimeException()).when(MyClass.class, parameter1, parameter2);Read more about those methods:
Mockito.doThrow(Throwable)
Mockito.doAnswer(Answer)
Mockito.doNothing()
Mockito.doReturn(Object)
See examples in javadoc for Mockito
java.lang.Exception
<T> void when(java.lang.Class<T> classMock, java.lang.String methodToExpect, java.lang.Object... parameters) throws java.lang.Exception
Example:
doThrow(new RuntimeException()).when(MyClass.class, "methodName", parameter1, parameter2);Read more about those methods:
Mockito.doThrow(Throwable)
Mockito.doAnswer(Answer)
Mockito.doNothing()
Mockito.doReturn(Object)
See examples in javadoc for Mockito
java.lang.Exception