This chapter covers
Demonstrating the Test-Driven Development (TDD) approach
Writing servlet and filter unit tests with Cactus and mock objects
Running Cactus tests with Maven
Choosing when to use Cactus and when to use mock objects
The only time you don’t fail is the last time you try anything—and it works.
When you unit-test servlet and filter code, you must test not only these objects, but also any Java class calling the Servlet/Filter API, the JNDI API, or any back-end services. Starting in this chapter, you’ll build a real-life sample application that will help demonstrate how to unit-test each of the different kinds of components that make up a full-blown web application. This chapter ...