Testing

Mocks Aren't Stubs by Martin Fowler

This article describes the difference between classical testing using stubs, and mock testing (using jMock or EasyMock).

How to choose a right approach for testing?

Definitions:

Mock Roles, Not Objects

You might notice that everything that the object needs is passed into it either in the constructor or with the method call. This is more or less forced on the programmer by the need to substitute the neighbouring objects with mock implementations. We believe that this is a strength, because it pushes the design towards small, focussed objects that interact only with known collaborators. It also encourages the programmer to create types to represent abstract concepts in the system, such as the ReloadPolicy, which gives a clearer separation of concerns in the code.

Mock Objects in practice:

Other