O'Reilly logo

JUnit in Action, Second Edition 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

Appendix B. Extending the JUnit API with custom runners and matchers

This appendix covers

  • Introducing the Interceptor pattern
  • Implementing custom runners for JUnit
  • Implementing custom matchers for JUnit

As we already discussed in chapter 2, the backbone of JUnit consists of three classes—TestClass, Runner, and Suite—the latter one being a Runner itself. This means that once we understand how those classes operate, we can write whatever tests we need with JUnit. If you find JUnit insufficient for your testing needs, you can extend the JUnit API with custom classes. Since JUnit is open source you can rebuild or extend. There is no obvious benefit in extending the TestClass class. On the other hand, the Runner class is especially designed to ...

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