Parameter Resolver: TestInfo
Explore how JUnit 5 supports dependency injection in tests through parameter resolvers, focusing on the built-in TestInfo resolver. Learn to retrieve information about the current test execution, including display names, tags, test class, and test methods, enabling more informative and dynamic testing.
We'll cover the following...
We'll cover the following...
What’s dependency injection?
It’s common for a test method to use external dependencies. In JUnit 5, test constructors and methods can have parameters to inject dependencies. However, not all types of parameters are allowed in constructors or methods. Extensions should be defined to resolve the parameters. The extension model allows for registering ...