Developer Forums | About Us | Site Map


Useful Lists

Web Host
site hosted by netplex

Online Manuals

Alexander Day Chaffee & William Pietri

Company: Purple Technology & Scissor
E-mail address:
Website address:

Alexander Day Chaffee is the founder of Purple Technology, a company that provides Java language, Extreme Programming, and open source consulting and training. He manages the Servlets FAQ for jGuru. As the Director of Software Engineering for EarthWeb, Alex co-created Gamelan, the official directory for the Java community. You can contact him at

William Pietri, the son of a systems analyst and an entrepreneur, started earning his lunch money with a computer at the age of thirteen. In the years since, he has worked in practically every facet of the technical world, from technical support to systems administration to software engineering to user-interface design. He is the founder of Scissor, a technology consulting firm. You can contact William at


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.

Read Tutorial   View Tutorial Discussion  

Copyright 2004-2023 All rights reserved.
Article copyright and all rights retained by the author.