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