public class AnswersWithDelay extends Object implements Answer<Object>, ValidableAnswer, Serializable
The sleepyTime
specifies how long, in milliseconds, to pause before
returning the provided answer
.
AdditionalAnswers
,
Serialized FormConstructor and Description |
---|
AnswersWithDelay(long sleepyTime,
Answer<Object> answer) |
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 Object answer(InvocationOnMock invocation) throws Throwable
public void validateFor(InvocationOnMock invocation)
ValidableAnswer
This 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 ValidableAnswer
invocation
- The stubbed invocationCopyright © 2021. All rights reserved.