public class DefaultLenientStubber extends java.lang.Object implements LenientStubber
| Modifier and Type | Field and Description |
|---|---|
private static MockitoCore |
MOCKITO_CORE |
| Constructor and Description |
|---|
DefaultLenientStubber() |
| Modifier and Type | Method and Description |
|---|---|
Stubber |
doAnswer(Answer answer)
Use it for stubbing consecutive calls in
Mockito.doAnswer(Answer) style:
|
Stubber |
doCallRealMethod()
Use it for stubbing consecutive calls in
Mockito.doCallRealMethod() style. |
Stubber |
doNothing()
Use it for stubbing consecutive calls in
Mockito.doNothing() style:
|
Stubber |
doReturn(java.lang.Object toBeReturned)
Use it for stubbing consecutive calls in
Mockito.doReturn(Object) style. |
Stubber |
doReturn(java.lang.Object toBeReturned,
java.lang.Object... nextToBeReturned)
Use it for stubbing consecutive calls in
Mockito.doReturn(Object) style. |
Stubber |
doThrow(java.lang.Class<? extends java.lang.Throwable> toBeThrown)
Use it for stubbing consecutive calls in
Mockito.doThrow(Class) style:
|
Stubber |
doThrow(java.lang.Class<? extends java.lang.Throwable> toBeThrown,
java.lang.Class<? extends java.lang.Throwable>... nextToBeThrown)
Use it for stubbing consecutive calls in
Mockito.doThrow(Class) style:
|
Stubber |
doThrow(java.lang.Throwable... toBeThrown)
Use it for stubbing consecutive calls in
Mockito.doThrow(Throwable[]) style:
|
private static Stubber |
stubber() |
<T> OngoingStubbing<T> |
when(T methodCall)
Allows declaring the method to stub.
|
private static final MockitoCore MOCKITO_CORE
public Stubber doThrow(java.lang.Throwable... toBeThrown)
BaseStubberMockito.doThrow(Throwable[]) style:
doThrow(new RuntimeException("one")).
doThrow(new RuntimeException("two"))
.when(mock).someVoidMethod();
See javadoc for Mockito.doThrow(Throwable[])doThrow in interface BaseStubbertoBeThrown - to be thrown when the stubbed method is calledpublic Stubber doThrow(java.lang.Class<? extends java.lang.Throwable> toBeThrown)
BaseStubberMockito.doThrow(Class) style:
doThrow(RuntimeException.class).
doThrow(IllegalArgumentException.class)
.when(mock).someVoidMethod();
See javadoc for Mockito.doThrow(Class)doThrow in interface BaseStubbertoBeThrown - exception class to be thrown when the stubbed method is calledpublic Stubber doThrow(java.lang.Class<? extends java.lang.Throwable> toBeThrown, java.lang.Class<? extends java.lang.Throwable>... nextToBeThrown)
BaseStubberMockito.doThrow(Class) style:
doThrow(RuntimeException.class).
doThrow(IllegalArgumentException.class)
.when(mock).someVoidMethod();
See javadoc for Mockito.doThrow(Class)doThrow in interface BaseStubbertoBeThrown - exception class to be thrown when the stubbed method is callednextToBeThrown - exception class next to be thrown when the stubbed method is calledpublic Stubber doAnswer(Answer answer)
BaseStubberMockito.doAnswer(Answer) style:
doAnswer(answerOne).
doAnswer(answerTwo)
.when(mock).someVoidMethod();
See javadoc for Mockito.doAnswer(Answer)doAnswer in interface BaseStubberanswer - to answer when the stubbed method is calledpublic Stubber doNothing()
BaseStubberMockito.doNothing() style:
doNothing().
doThrow(new RuntimeException("two"))
.when(mock).someVoidMethod();
See javadoc for Mockito.doNothing()doNothing in interface BaseStubberpublic Stubber doReturn(java.lang.Object toBeReturned)
BaseStubberMockito.doReturn(Object) style.
See javadoc for Mockito.doReturn(Object)
doReturn in interface BaseStubbertoBeReturned - to be returned when the stubbed method is calledpublic Stubber doReturn(java.lang.Object toBeReturned, java.lang.Object... nextToBeReturned)
BaseStubberMockito.doReturn(Object) style.
See javadoc for Mockito.doReturn(Object, Object...)
doReturn in interface BaseStubbertoBeReturned - to be returned when the stubbed method is callednextToBeReturned - to be returned in consecutive calls when the stubbed method is calledpublic Stubber doCallRealMethod()
BaseStubberMockito.doCallRealMethod() style.
See javadoc for Mockito.doCallRealMethod()
doCallRealMethod in interface BaseStubberpublic <T> OngoingStubbing<T> when(T methodCall)
LenientStubberMockito.when(Object).
Needed for classic stubbing with when().then()when in interface LenientStubberprivate static Stubber stubber()