Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.1.0-beta, 3.0.0-alpha1
-
None
-
Reviewed
Description
Seen internally and during upstream trunk builds, error like the following:
Error Message: Unfinished stubbing detected here: -> at org.apache.hadoop.hdfs.TestLeaseRenewer.testThreadName(TestLeaseRenewer.java:197) E.g. thenReturn() may be missing. Examples of correct stubbing: when(mock.isOk()).thenReturn(true); when(mock.isOk()).thenThrow(exception); doThrow(exception).when(mock).someVoidMethod(); Hints: 1. missing thenReturn() 2. although stubbed methods may return mocks, you cannot inline mock creation (mock()) call inside a thenReturn method (see issue 53) Stack Trace: org.mockito.exceptions.misusing.UnfinishedStubbingException: Unfinished stubbing detected here: -> at org.apache.hadoop.hdfs.TestLeaseRenewer.testThreadName(TestLeaseRenewer.java:197)
I believe it's due to mocking while being concurrently accessed by another thread.