草庐IT

ParamAndReturnType

全部标签

java - 如何在easymock中模拟一个返回其参数之一的方法?

publicObjectdoSomething(Objecto);我想模拟的。它应该只返回它的参数。我试过了:CapturecopyCaptcher=newCapture();expect(mock.doSomething(capture(copyCaptcher))).andReturn(copyCatcher.getValue());但没有成功,我得到一个AssertionError作为java.lang.AssertionError:Nothingcaptureyet。有什么想法吗? 最佳答案 嗯,最简单的方法是在IAnswe

java - 如何在easymock中模拟一个返回其参数之一的方法?

publicObjectdoSomething(Objecto);我想模拟的。它应该只返回它的参数。我试过了:CapturecopyCaptcher=newCapture();expect(mock.doSomething(capture(copyCaptcher))).andReturn(copyCatcher.getValue());但没有成功,我得到一个AssertionError作为java.lang.AssertionError:Nothingcaptureyet。有什么想法吗? 最佳答案 嗯,最简单的方法是在IAnswe