how to avoid returning mocks from a mocked object list

Posted by koen on Stack Overflow See other posts from Stack Overflow or by koen
Published on 2010-04-20T19:51:41Z Indexed on 2010/04/20 23:33 UTC
Read the original article Hit count: 310

Filed under:
|
|
|

I'm trying out mock/responsibility driven design. I seem to have problems to avoid returning mocks from mocks in the case of finder objects.

An example could be an object that checks whether the bills from last month are paid. It needs a service that retrieves a list of bills for that. So I need to mock that service that retrieves the bills. At the same time I need that mock to return mocked Bills (since I don't want my test to rely on the correctness bill implementation).

Is my design flawed? Is there a better way to test this? Or is this the way it will need to be when using finder objects (the finding of the bills in this case)?

© Stack Overflow or respective owner

Related posts about TDD

Related posts about mocking