Package org.apache.hadoop.hbase
Class GenericTestUtils.DelegateAnswer
java.lang.Object
org.apache.hadoop.hbase.GenericTestUtils.DelegateAnswer
- 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(...);
...
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDelegateAnswer
(Object delegate) DelegateAnswer
(org.slf4j.Logger log, Object delegate) -
Method Summary