O'Reilly logo

JUnit Recipes: Practical Methods for Programmer Testing by J B Rainsberger, Scott Stirling

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required