I am trying to configure mocks for mongodb in my java code and I get the following exception:
org.mockito.exceptions.misusing.WrongTypeOfReturnValue: DBCursor$$EnhancerByMockitoWithCGLIB$$fc4f0e22 cannot be returned by getOptions() getOptions() should return int
The line of code that generates this:
when(col.find(query)).thenReturn(cursor);
If col is the mocked DBCollection, the query is the mocked DBObject and the cursor is the mocked DBCursor.
I found the following very vague, but probably relevant description of the problem:
http://osdir.com/ml/mongodb-user/2010-08/msg02102.html
Kevin source share