JUnit 5 is the next generation of JUnit. The goal of this upcoming version is to create an up-to-date foundation for developer-side testing on the JVM. The evolution includes focusing on Java 8 and above, as well as enabling many different styles of testing. In his article, Nicolai Parlog explains how you should write tests with JUnit 5.
After explaining how JUnit 5 should be setup, the article starts with some examples of the new Java unit tests written with JUnit 5: classic assertions, extended assertions or nesting tests. Then he explains the concept of dynamic tests that allows to define tests at run time. He also describes the JUnit 5 extension model, which defines a list extension points like Test Instance Post Processor, BeforeAll Callback or Test & Container Execution Condition. In his conclusion, he mentions that “JUnit 5 isolates “JUnit the platform” from “JUnit the tool” by implementing a clear separation of concerns and splitting itself into three subprojects.” This separation between JUnit Jupiter and JUnit Platform means that JUnit Jupiter can evolve without tools depending on some implementation details, as it was the case with the previous versions of JUnit.
Read the complete article on https://jaxlondon.com/blog/junit-5-next-generation-testing-on-the-jvm/