O'Reilly logo

Mastering Software Testing with JUnit 5 by Boni García

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

TestInfoParameterResolver

Given a test class, if a method parameter is of type TestInfo, the JUnit 5 resolver TestInfoParameterResolver supplies an instance of TestInfo corresponding to the current test as the value for the declared parameter. The TestInfo object is used to retrieve information about the current test, such as the test display name, the test class, the test method, or associated tags.

TestInfo acts as a drop-in replacement for the TestName rule from JUnit 4.

The class TestInfo is placed in the package org.junit.jupiter.api and offers the following API:

  • String getDisplayName() : This returns the display name of the test or container.
  • Set<String> getTags() : This gets the set of all tags for the current test or container.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required