Cover by Gary Gregory, Vincent Massol, Felipe Leme, Petar Tahchiev

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

O'Reilly logo

Chapter 3. Mastering JUnit

Tests are the Programmer’s Stone, transmuting fear into boredom.

Kent Beck, Test First Development

This chapter covers

  • Implementing a sample application
  • Testing the sample application with JUnit
  • Following JUnit best practices

So far, we’ve made a JUnit survey and shown how to use it (chapter 1). We also looked at JUnit internals, what the core classes and methods are, and how they interact with each other (chapter 2).

We now dive deeper by introducing a real-life component and testing it. In this chapter, we implement a small application using the Controller design pattern. We then test every part of the application using JUnit. We also look at JUnit best practices when writing and organizing your tests.

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