O'Reilly logo

The Well-Grounded Java Developer: Vital techniques of Java 7 and polyglot programming by Benjamin J. Evans and Martijn Verburg

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 11. Test-driven development

This chapter covers

  • The benefits of practicing test-driven development (TDD)
  • The red-green-refactor lifecycle at the heart of TDD
  • A brief intro to JUnit, the de facto Java testing framework
  • The four types of test double: dummy, fake, stub, and mock
  • Testing against an in-memory database for your DAO code
  • Mocking subsystems with Mockito
  • Using ScalaTest, the testing framework for Scala

Test-driven development (TDD) has been part of the software development industry for quite some time. Its basic premise is that you write a test before writing the code that actually provides the implementation, and then you refactor that implementation as needed. For example, in order to write an implementation of concatenating ...

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