Class AnswersWithDelay
java.lang.Object
org.mockito.internal.stubbing.answers.AnswersWithDelay
- All Implemented Interfaces:
Serializable
,Answer<Object>
,ValidableAnswer
public class AnswersWithDelay
extends Object
implements Answer<Object>, ValidableAnswer, Serializable
Returns as the provided answer would return, after delaying the specified amount.
The sleepyTime
specifies how long, in milliseconds, to pause before
returning the provided answer
.
- Since:
- 2.8.44
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
private final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionanswer
(InvocationOnMock invocation) void
validateFor
(InvocationOnMock invocation) Validation of the answer at stub time for the given invocation.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
sleepyTime
private final long sleepyTime -
answer
-
-
Constructor Details
-
AnswersWithDelay
-
-
Method Details
-
answer
-
validateFor
Description copied from interface:ValidableAnswer
Validation of the answer at stub time for the given invocation.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.
- Specified by:
validateFor
in interfaceValidableAnswer
- Parameters:
invocation
- The stubbed invocation
-