I'm trying to setup mocks for mongodb in my java code, and I'm getting 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 is:
when(col.find(query)).thenReturn(cursor);
Where col is a mocked DBCollection, query is a mocked DBObject, and cursor is a mocked DBCursor.
I've found the following very vague but probably relevant problem description: