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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

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