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,
java.lang.Object delegate)
Get an instance with the provided properties.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
answer(org.mockito.invocation.InvocationOnMock invocation) |
boolean |
await(int timeout)
Wait for the latch to count down.
|
java.util.Collection<java.lang.Exception> |
getExceptions()
Return the exceptions thrown.
|
java.util.concurrent.CountDownLatch |
getLatch() |
@Deprecated public LatchCountDownAndCallRealMethodAnswer(int count)
LatchCountDownAndCallRealMethodAnswer(int, Object).count - to set in a CountDownLatch.public LatchCountDownAndCallRealMethodAnswer(int count,
@Nullable
java.lang.Object delegate)
count - the count.delegate - the delegate.public java.lang.Object answer(org.mockito.invocation.InvocationOnMock invocation)
throws java.lang.Throwable
answer in interface org.mockito.stubbing.Answer<java.lang.Object>answer in class org.mockito.internal.stubbing.defaultanswers.ForwardsInvocationsjava.lang.Throwablepublic boolean await(int timeout)
throws java.lang.InterruptedException
timeout - the timeout in seconds.java.lang.InterruptedException - if the thread is interrupted.public java.util.concurrent.CountDownLatch getLatch()
@Nullable public java.util.Collection<java.lang.Exception> getExceptions()