Package org.apache.hadoop.hbase
Class GenericTestUtils.DelayAnswer
java.lang.Object
org.apache.hadoop.hbase.GenericTestUtils.DelayAnswer
- All Implemented Interfaces:
org.mockito.stubbing.Answer<Object>
- Enclosing class:
- GenericTestUtils
public static class GenericTestUtils.DelayAnswer
extends Object
implements org.mockito.stubbing.Answer<Object>
Mockito answer helper that triggers one latch as soon as the method is called, then waits on
another before continuing.
-
Field Summary
Modifier and TypeFieldDescriptionprivate final AtomicInteger
private final CountDownLatch
private final org.slf4j.Logger
private final AtomicInteger
private final CountDownLatch
private Object
private Throwable
private final CountDownLatch
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionanswer
(org.mockito.invocation.InvocationOnMock invocation) int
int
After the call has gone through, return the call's return value, or null in case it was void or an exception was thrown.After the call has gone through, return any exception that was thrown, or null if no exception was thrown.protected Object
passThrough
(org.mockito.invocation.InvocationOnMock invocation) void
proceed()
Tell the method to proceed.void
Wait until the method is called.void
After calling proceed(), this will wait until the call has completed and a result has been returned to the caller.
-
Field Details
-
LOG
-
fireLatch
-
waitLatch
-
resultLatch
-
fireCounter
-
resultCounter
-
thrown
-
returnValue
-
-
Constructor Details
-
DelayAnswer
-
-
Method Details
-
waitForCall
Wait until the method is called.- Throws:
InterruptedException
-
proceed
Tell the method to proceed. This should only be called after waitForCall() -
answer
-
passThrough
- Throws:
Throwable
-
waitForResult
After calling proceed(), this will wait until the call has completed and a result has been returned to the caller.- Throws:
InterruptedException
-
getThrown
After the call has gone through, return any exception that was thrown, or null if no exception was thrown. -
getReturnValue
After the call has gone through, return the call's return value, or null in case it was void or an exception was thrown. -
getFireCount
-
getResultCount
-