Class LatchCountDownAndCallRealMethodAnswer
java.lang.Object
org.mockito.internal.stubbing.defaultanswers.ForwardsInvocations
org.springframework.amqp.rabbit.test.mockito.LatchCountDownAndCallRealMethodAnswer
- All Implemented Interfaces:
Serializable
,org.mockito.stubbing.Answer<Object>
public class LatchCountDownAndCallRealMethodAnswer
extends org.mockito.internal.stubbing.defaultanswers.ForwardsInvocations
An
Answer
for void returning methods that calls the real
method and counts down a latch. Captures any exceptions thrown.- Since:
- 1.6
- Author:
- Gary Russell
- See Also:
-
Constructor Summary
ConstructorDescriptionLatchCountDownAndCallRealMethodAnswer
(int count) Deprecated.LatchCountDownAndCallRealMethodAnswer
(int count, Object delegate) Get an instance with the provided properties. -
Method Summary
-
Constructor Details
-
LatchCountDownAndCallRealMethodAnswer
Deprecated.in favor ofLatchCountDownAndCallRealMethodAnswer(int, Object)
.Get an instance with no delegate.- Parameters:
count
- to set in aCountDownLatch
.
-
LatchCountDownAndCallRealMethodAnswer
Get an instance with the provided properties. Use the test harness to get an instance with the proper delegate.- Parameters:
count
- the count.delegate
- the delegate.- Since:
- 2.1.16
-
-
Method Details
-
answer
-
await
Wait for the latch to count down.- Parameters:
timeout
- the timeout in seconds.- Returns:
- the result of awaiting on the latch; true if counted down.
- Throws:
InterruptedException
- if the thread is interrupted.- Since:
- 2.1.16
-
getLatch
-
getExceptions
Return the exceptions thrown.- Returns:
- the exceptions.
- Since:
- 2.2.3
-
LatchCountDownAndCallRealMethodAnswer(int, Object)
.