public class LatchCountDownAndCallRealMethodAnswer
extends org.mockito.internal.stubbing.defaultanswers.ForwardsInvocations
Answer
for void returning methods that calls the real
method and counts down a latch. Captures any exceptions thrown.Constructor and Description |
---|
LatchCountDownAndCallRealMethodAnswer(int count)
Deprecated.
in favor of
LatchCountDownAndCallRealMethodAnswer(int, Object) . |
LatchCountDownAndCallRealMethodAnswer(int count,
Object delegate)
Get an instance with the provided properties.
|
Modifier and Type | Method and Description |
---|---|
Object |
answer(org.mockito.invocation.InvocationOnMock invocation) |
boolean |
await(int timeout)
Wait for the latch to count down.
|
Collection<Exception> |
getExceptions()
Return the exceptions thrown.
|
CountDownLatch |
getLatch() |
@Deprecated public LatchCountDownAndCallRealMethodAnswer(int count)
LatchCountDownAndCallRealMethodAnswer(int, Object)
.count
- to set in a CountDownLatch
.public LatchCountDownAndCallRealMethodAnswer(int count, @Nullable Object delegate)
count
- the count.delegate
- the delegate.public boolean await(int timeout) throws InterruptedException
timeout
- the timeout in seconds.InterruptedException
- if the thread is interrupted.public CountDownLatch getLatch()
@Nullable public Collection<Exception> getExceptions()