|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--jface.mockobject.MockObjectManager
Under certain circumstances, the construction of mock objects is very complicated. Especially when testing classes, that contain deep in their code classes that need to be mocked up. Also classes with lots of external resources need complex mock up structures.
To solve this problem, the MockObjectManager can be used. The class
that is tested, needs a special structure to be used with the MockObjectManager, which is described as follows:
Assume, a class, called BigComplicatedClass, has lots of connections to databases and other external resources. All the calls to these collaborators should be extracted into an inner interface, to provide a clear structure for the mockup:
public class BigComplicatedClass
{
Collaborator col;
public BigComplicatedClass()
{
col = new DefaultCollaborator();
}
public