2
的我遇到了问题:EasyMock的期望调用方法与集合类型参数
expect(dao.save(collectionOfElements)).andReturn(otherCollection);
当我重播然后我把这个DAO方法与当时的我得到意想不到的通话
Unexpected method call save(someObj1, someObj2)
save(someObj1, someObj2): expected: 1, actual: 0
someObj1等于来自期望调用的someObj1,并且元素甚至以相同的顺序。
起初我解决了这个这样:
expect(dao.save(isA(Collecion.class))).andReturn(otherCollection);
但现在我一定要考,做我的服务类电话dao.save的时候只有2个元素集合,所以isA(Collecion.class)
不工作了。
如何解决这个问题?比你。
是的,someObj包含org.joda.DateTime类型的变量,并且由于它没有hasCode和等于方法而导致问题。 – vrm 2010-12-03 13:30:40