Chapter 14. Testing design patterns

This chapter covers

  • Testing the Observer/Observable pattern
  • Testing the Singleton pattern
  • Testing the Factory pattern
  • Testing the Template Method pattern

Design Patterns have been around for quite a long time, now—enough time to have become part of the common vocabulary of Java programmers. As we become more comfortable discussing designs in terms of the patterns we apply, we begin to wonder what kinds of tests are most appropriate when we apply those patterns. For example, if there is a special set of cases that one typically needs to cover in order to effectively test the Flyweight pattern,[1] then we would like to know about them. As we plan to apply the pattern, we can be sure to include the corresponding ...

Get JUnit Recipes: Practical Methods for Programmer Testing now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.