This chapter covers
Testing larger components
Tests are the Programmer’s Stone, transmuting fear into boredom.
|--Kent Beck, Test First Development|
Now that you’ve had an introduction to JUnit, you’re ready to see how it works on a practical application. Let’s walk through a case study of testing a single, significant component, like one your team leader might assign to you. We should choose a component that is both useful and easy to understand, common to many applications, large enough to give us something to play with, but small enough that we can cover it here. How about a controller?
In this chapter, we’ll first introduce the case-study code, identify what code to test, and then show how to test ...