Chapter 2. Elementary tests
This chapter covers
- General techniques for testing individual methods
- Specific techniques for testing JavaBeans
- Specific techniques for testing interfaces
- Comparing objects for equality in tests
The simplest kind of Programmer Test you will write verifies the return value of a method. This technique is the building block for all the testing you will ever do with JUnit. In the rest of this book we try to reduce every complex testing problem down to this, the simplest of scenarios. We begin by describing this scenario in detail; then the remaining recipes in this chapter will build gradually from there. These recipes provide not only the solutions to common problems, but also a rudimentary vocabulary that we can use ...
Get JUnit Recipes now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.