public class ThrowsException extends Object implements Answer<Object>, ValidableAnswer, Serializable
| Constructor and Description |
|---|
ThrowsException(Throwable throwable)
Creates a new answer always throwing the given throwable.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
answer(InvocationOnMock invocation) |
void |
validateFor(InvocationOnMock invocation)
Validation of the answer at stub time for the given invocation.
|
public ThrowsException(Throwable throwable)
public Object answer(InvocationOnMock invocation) throws Throwable
public void validateFor(InvocationOnMock invocation)
ValidableAnswerThis method will be called by Mockito.
The implementation must throw an MockitoException to indicate that this answer is not valid for the given invocation. If the validation succeed the implementation must simply return without throwing.
validateFor in interface ValidableAnswerinvocation - The stubbed invocationCopyright © 2024. All rights reserved.