- All Implemented Interfaces:
- org.mockito.stubbing.Answer<Object>
- Enclosing class:
- GenericTestUtils
public static class GenericTestUtils.DelegateAnswer
extends Object
implements org.mockito.stubbing.Answer<Object>
An Answer implementation that simply forwards all calls through to a delegate. This is useful
as the default Answer for a mock object, to create something like a spy on an RPC proxy. For
example:
NamenodeProtocol origNNProxy = secondary.getNameNode();
NamenodeProtocol spyNNProxy = Mockito.mock(NameNodeProtocol.class,
new DelegateAnswer(origNNProxy);
doThrow(...).when(spyNNProxy).getBlockLocations(...);
...