Unit testing with mock objects (IBM developerWorks)
[Posted November 26, 2002 by cook]
Alexander Day Chaffee and William Pietri
cover the use of mock objects on IBM developerWorks.
"
Mock objects are a useful way to write unit tests for objects that act as mediators. Instead of calling the real domain objects, the tested object calls a mock domain object that merely asserts that the correct methods were called, with the expected parameters, in the correct order. However, when the tested object must create the domain object, we are faced with a problem. How does the tested object know to create a mock domain object instead of the true domain object? In this article, software consultants Alexander Day Chaffee and William Pietri present a refactoring technique to create mock objects based on the factory method design pattern."
(
Log in to post comments)