One of the goals of JUnit 5 is to make the interface between JUnit and its programmatic clients (build tools and IDEs) more powerful and stable. To that aim, the Test Launcher API has been implemented. This API is used by IDEs and build tools for discovering, filtering, and executing tests.
Looking closer at the details of this API, we find the class LauncherDiscoveryRequest, which exposes a fluent API to select the location of tests (for example classes, methods, or packages). This group of tests can be filtered, for example, using a match pattern:
import static org.junit.platform.engine.discovery.ClassNameFilter.includeClassNamePatterns;import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass;