|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mockito.internal.stubbing.StubberImpl
org.powermock.api.mockito.internal.expectation.PowerMockitoStubberImpl
public class PowerMockitoStubberImpl
Extension of the standard Mocktio stubber implementation that also support PowerMockito created mocks.
| Constructor Summary | |
|---|---|
PowerMockitoStubberImpl()
|
|
| Method Summary | ||
|---|---|---|
void |
when(Class<?> classMock)
Allows to choose a static method when stubbing in doThrow()|doAnswer()|doNothing()|doReturn() style Example: doThrow(new RuntimeException()).when(); 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 |
|
|
when(Class<T> classMock,
Method method)
Allows to mock a static private method when stubbing in doThrow()|doAnswer()|doNothing()|doReturn() style. |
|
|
when(Class<T> classMock,
Object... arguments)
Allows to mock a static private method based on the parameters when stubbing in doThrow()|doAnswer()|doNothing()|doReturn() style. |
|
|
when(Class<T> classMock,
String methodToExpect,
Object... parameters)
Allows to mock a static private method based on method name and parameters when stubbing in doThrow()|doAnswer()|doNothing()|doReturn() style. |
|
|
when(T instanceMock)
Supports PowerMockito mocks. |
|
|
when(T mock,
Method method)
Allows to mock a private instance method when stubbing in doThrow()|doAnswer()|doNothing()|doReturn() style. |
|
|
when(T mock,
Object... arguments)
Allows to mock a private instance method based on the parameters when stubbing in doThrow()|doAnswer()|doNothing()|doReturn() style. |
|
|
when(T mock,
String methodToExpect,
Object... arguments)
Allows to mock a private instance method based on method name and parameters when stubbing in doThrow()|doAnswer()|doNothing()|doReturn() style. |
|
| Methods inherited from class org.mockito.internal.stubbing.StubberImpl |
|---|
doAnswer, doNothing, doReturn, doThrow |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.mockito.stubbing.Stubber |
|---|
doAnswer, doNothing, doReturn, doThrow |
| Constructor Detail |
|---|
public PowerMockitoStubberImpl()
| Method Detail |
|---|
public void when(Class<?> classMock)
Example:
doThrow(new RuntimeException()).when(); 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
when in interface PowerMockitoStubberpublic <T> T when(T instanceMock)
mock is not a PowerMockito
mock it will delegate to Mockito.
when in interface org.mockito.stubbing.Stubberwhen in class org.mockito.internal.stubbing.StubberImplStubber.when(Object)
public <T> PrivatelyExpectedArguments when(T mock,
Method method)
throws Exception
PowerMockitoStubberExample:
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
when in interface PowerMockitoStubberException
public <T> void when(T mock,
Object... arguments)
throws Exception
PowerMockitoStubberExample:
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
when in interface PowerMockitoStubberException
public <T> void when(T mock,
String methodToExpect,
Object... arguments)
throws Exception
PowerMockitoStubberExample:
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
when in interface PowerMockitoStubberException
public <T> void when(Class<T> classMock,
Object... arguments)
throws Exception
PowerMockitoStubberExample:
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
when in interface PowerMockitoStubberException
public <T> void when(Class<T> classMock,
String methodToExpect,
Object... parameters)
throws Exception
PowerMockitoStubberExample:
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
when in interface PowerMockitoStubberException
public <T> PrivatelyExpectedArguments when(Class<T> classMock,
Method method)
throws Exception
PowerMockitoStubberExample:
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
when in interface PowerMockitoStubberException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||