A Techno Blog, mainly about Java

Mock Objects

A mock object conforms to the interface of the real object, but has just enough code to fool the tested object and track its behavior.

  • Target object: The object being tested
  • Collaborator object: The object created or obtained by the target
  • Mock object: A subclass (or implementation) of the collaborator that follows the mock object pattern.
  • Specialization object: A subclass of the target that overrides the creation method to return a mock instead of a collaborator
  • Unit testing is the testing of software units in isolation. However, most units do not work alone, but they collaborate with other units. Mock objects are Replacements for collaborators.

    EasyMock provides an easy way to use Mock Objects for given interfaces in  JUNIT tests.

    February 25, 2005 - Posted by | SW Tools

    No comments yet.

    Leave a Reply

    Fill in your details below or click an icon to log in: Logo

    You are commenting using your account. Log Out /  Change )

    Google photo

    You are commenting using your Google account. Log Out /  Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out /  Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out /  Change )

    Connecting to %s

    %d bloggers like this: