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