java - EasyMock methods with parameters returning void -


my unit test framework replaces business service components mock objects using easymock.createmock(interace).

these components accessed several layers down in class under test don't wish modify either interface definition nor class undertest.

i use easymock.expect(...) drive behavoir of collaborating objects. works great long methods don't return void.

how can drive behavior when there void results. ie.

easymock.expect(object.method( easymock.isa(arg1) ).andanswer( new ianswer()){     public void anser(){    ... seomething meaningful arg1...     }).anytimes(); 

you can use expectlastcall().andreturn("something");.

you don't mention version of easymock you're using, think feature has been around while anyway.

read more in documentation.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -