Using the TestInfoParameterResolver Class
Understand the use of dependency injection in JUnit 5 with the TestInfoParameterResolver.
We'll cover the following...
In previous JUnit
versions, the constructors and methods in the tests did not have parameters. With Jupiter
, it’s possible to define the constructor and method parameters. This enables dependency injection
for our tests.
Jupiter
provides the interface, ParameterResolver
, which helps an API resolve the constructor and method parameters at runtime.
The ParameterResolver
interface has three main implementations— ...