我正在尝试在我的Java代码中设置mongodb的mocks,并且我遇到了以下异常:
生成此内容的代码行是:
在这里,col是模拟的DBCollection,query是模拟的DBObject,cursor是模拟的DBCursor。
我发现以下问题描述非常模糊,但可能与问题有关:http://osdir.com/ml/mongodb-user/2010-08/msg02102.html
org.mockito.exceptions.misusing.WrongTypeOfReturnValue:
DBCursor$$EnhancerByMockitoWithCGLIB$$fc4f0e22 cannot be returned by getOptions()
getOptions() should return int
生成此内容的代码行是:
when(col.find(query)).thenReturn(cursor);
在这里,col是模拟的DBCollection,query是模拟的DBObject,cursor是模拟的DBCursor。
我发现以下问题描述非常模糊,但可能与问题有关:http://osdir.com/ml/mongodb-user/2010-08/msg02102.html