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
FieldsModifier and TypeFieldDescriptionprivate final AtomicIntegerprivate final CountDownLatchprivate final org.slf4j.Loggerprivate final AtomicIntegerprivate final CountDownLatchprivate Objectprivate Throwableprivate final CountDownLatch -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionanswer(org.mockito.invocation.InvocationOnMock invocation) intintAfter 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 ObjectpassThrough(org.mockito.invocation.InvocationOnMock invocation) voidproceed()Tell the method to proceed.voidWait until the method is called.voidAfter 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
-