In the last chapter we wrote tests against a simple example class named ScoreCollection that calculates an arithmetic mean. Working through that exercise helped us get a good handle on JUnit fundamentals.
Pat wasn’t impressed, however. “All that effort to test a tiny class that averages a bunch of numbers? Real code isn’t so simple.”
True, Pat, although the previous chapter was more about getting you comfortable with JUnit. We could write more tests against ScoreCollection, but it’s time to move on to testing code closer to the reality of the average system.
In this chapter we’ll spend a little time looking at a meatier bit of code that we want to test. The analysis effort will help us to focus on writing ...