The Sampling JUnit chapter creates a test case for an application controller, which examines how several components work together. It introduces the case-study code, identifies what code to test, shows how to test it, and creates tests for exceptional conditions.
The Testing in isolation with mock objects chapter introduces and demontrates mock objects, shows how to use mock objects as a refactoring technique, how mock objects can verify API contracts on collaborating classes, and looks at how mock objects can be used an HTTP connection sample application.
These two chapters have been excerpted from 'JUnit in Action' (Manning Publications), by Vincent Massol and Ted Husted.
About the Authors
Vincent Massol is Chief Technology Officer of Pivolis which specializes in agile offshore software development. Vince is an active member of the Maven, Gump and MockObjects development teams and the creator of the Jakarta Cactus testing framework. He lives in Paris, France.
Ted Husted is an acknowledged Struts authority, an active member of the Struts development team, and manager of the JGuru Struts Forum. Ted has worked with professional Struts development teams throughout the United States and also helps manage the Apache Jakarta project. Ted lives in Fairport, New York.