Chapter 6. Reducing Boilerplate with JUnit Rules
We already explained how to minimize clutter and redundancy in test cases by extracting coherent utility code into separate test helpers, as seen in Chapter 3, Developing Independently Testable Units. In this chapter, you'll learn how to enhance this strategy by means of JUnit rules. You'll be given an introduction to the approach's mechanics and potential. To deepen this knowledge, we'll continue by writing and varying a sample extension. Then, we'll examine advanced features of rules-related functionality and conclude with the inspection of useful third-party vendor offerings. In short, this will make us capable of the following:
- Understanding rules
- Working with advanced concepts
- Employing custom solutions