JUnit 5 - Part II
In the first part , I gave you a brief introduction to the basic functionality of the new JUnit 5 framework: new asserts, testing exceptions and timing, parameterizing and structuring tests. In this part I will explain the extension mechanism, which serves as a replacement for the runners and rules. The New Extension Model JUnit 4 introduced the concept of runners, which allowed you to implement a strategy on how to run a test. You could specify the runner to use by attaching the @RunWith annotation to the test class, where the value of the annotation specified the runner class to use. You could do quite a lot of stuff with runners, but they had one central drawback: you could specify only one runner on a test :-| Since this was not flexible enough for most people, they invented the concept of rules. Rules allows you to intercept the test execution, so you can do all kind of stuff here like test preparation and cleanup, but also conditionally executing a test. Additionally y...