After
In this chapter you got past one of the more significant challenges: getting a first test to pass using JUnit in your IDE. Congrats! But life, and most “real” code, isn’t so simple. In the next chapter, you’ll tackle writing tests for a meatier example and learn quite a bit more about JUnit in the process.
Before moving on: we wrote one test against ScoreCollection. That might or might not be sufficient. Take a few moments and analyze ScoreCollection’s code. Ask yourself:
-
Do I need to write additional tests to feel confident that the code works?
-
Could I write tests that expose defects or limitations in the class?
In the next several chapters, we’ll explore how to best answer those questions for any code you’re testing.
Footnotes
| [9] |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access