public static class GenericTestUtils.DelayAnswer extends Object implements org.mockito.stubbing.Answer<Object>
Modifier and Type | Field and Description |
---|---|
private AtomicInteger |
fireCounter |
private CountDownLatch |
fireLatch |
private org.slf4j.Logger |
LOG |
private AtomicInteger |
resultCounter |
private CountDownLatch |
resultLatch |
private Object |
returnValue |
private Throwable |
thrown |
private CountDownLatch |
waitLatch |
Constructor and Description |
---|
DelayAnswer(org.slf4j.Logger log) |
Modifier and Type | Method and Description |
---|---|
Object |
answer(org.mockito.invocation.InvocationOnMock invocation) |
int |
getFireCount() |
int |
getResultCount() |
Object |
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.
|
Throwable |
getThrown()
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 |
waitForCall()
Wait until the method is called.
|
void |
waitForResult()
After calling proceed(), this will wait until the call has completed and a result has been
returned to the caller.
|
private final org.slf4j.Logger LOG
private final CountDownLatch fireLatch
private final CountDownLatch waitLatch
private final CountDownLatch resultLatch
private final AtomicInteger fireCounter
private final AtomicInteger resultCounter
private volatile Object returnValue
public DelayAnswer(org.slf4j.Logger log)
public void waitForCall() throws InterruptedException
InterruptedException
public void proceed()
protected Object passThrough(org.mockito.invocation.InvocationOnMock invocation) throws Throwable
Throwable
public void waitForResult() throws InterruptedException
InterruptedException
public Throwable getThrown()
public Object getReturnValue()
public int getFireCount()
public int getResultCount()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.