Ted Yu created HBASE-11019:
------------------------------
Summary: incCount() method should be properly stubbed in
HConnectionTestingUtility#getMockedConnectionAndDecorate()
Key: HBASE-11019
URL: https://issues.apache.org/jira/browse/HBASE-11019
Project: HBase
Issue Type: Test
Reporter: Ted Yu
Assignee: Ted Yu
Priority: Minor
Attachments: 11019-v1.txt
>From
>https://builds.apache.org/job/PreCommit-HBASE-Build/9306//testReport/org.apache.hadoop.hbase.master/TestAssignmentManager/testClosingFailureDuringRecovery/
> :
{code}
org.mockito.exceptions.base.MockitoException:
'incCount' is a *void method* and it *cannot* be stubbed with a *return value*!
Voids are usually stubbed with Throwables:
doThrow(exception).when(mock).someVoidMethod();
***
If you're unsure why you're getting above error read on.
Due to the nature of the syntax above problem might occur because:
1. The method you are trying to stub is *overloaded*. Make sure you are calling
the right overloaded version.
2. Somewhere in your test you are stubbing *final methods*. Sorry, Mockito does
not verify/stub final methods.
3. A spy is stubbed using when(spy.foo()).then() syntax. It is safer to stub
spies -
- with doReturn|Throw() family of methods. More in javadocs for
Mockito.spy() method.
at
org.apache.hadoop.hbase.client.HConnectionTestingUtility.getMockedConnectionAndDecorate(HConnectionTestingUtility.java:124)
at
org.apache.hadoop.hbase.master.TestAssignmentManager.setUpMockedAssignmentManager(TestAssignmentManager.java:1141)
at
org.apache.hadoop.hbase.master.TestAssignmentManager.testClosingFailureDuringRecovery(TestAssignmentManager.java:1027)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
{code}
incCount() should be properly stubbed.
--
This message was sent by Atlassian JIRA
(v6.2#6252)