Class JUnitPlatformProvider

java.lang.Object
org.apache.maven.surefire.api.provider.AbstractProvider
org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
All Implemented Interfaces:
SurefireProvider

public class JUnitPlatformProvider extends AbstractProvider
JUnit 5 Platform Provider.
Since:
2.22.0
  • Field Details

    • CONFIGURATION_PARAMETERS

      static final String CONFIGURATION_PARAMETERS
      See Also:
    • parameters

      private final ProviderParameters parameters
    • launcher

      private final org.junit.platform.launcher.Launcher launcher
    • filters

      private final org.junit.platform.engine.Filter<?>[] filters
    • configurationParameters

      private final Map<String,String> configurationParameters
  • Constructor Details

    • JUnitPlatformProvider

      public JUnitPlatformProvider(ProviderParameters parameters)
    • JUnitPlatformProvider

      JUnitPlatformProvider(ProviderParameters parameters, org.junit.platform.launcher.Launcher launcher)
  • Method Details

    • getSuites

      public Iterable<Class<?>> getSuites()
      Description copied from interface: SurefireProvider
      Determines the number of forks.
      Called when forkmode is different from "never" or "always", allows the provider to define how to behave for the fork.
      Returns:
      An iterator that will trigger one fork per item
    • invoke

      public RunResult invoke(Object forkTestSet) throws TestSetFailedException, ReporterException
      Description copied from interface: SurefireProvider
      Runs a forked test
      Parameters:
      forkTestSet - An item from the iterator in #getSuites. Will be null for forkmode never or always. When this is non-null, the forked process will run only that test and probably not scan the classpath
      Returns:
      A result of the invocation
      Throws:
      TestSetFailedException - When testset fails
      ReporterException - When reporting fails
    • setupJunitLogger

      private static void setupJunitLogger()
    • scanClasspath

      private TestsToRun scanClasspath()
    • invokeAllTests

      private void invokeAllTests(TestsToRun testsToRun, RunListenerAdapter adapter)
    • execute

      private void execute(TestsToRun testsToRun, RunListenerAdapter adapter)
    • closeLauncher

      private void closeLauncher()
    • buildLauncherDiscoveryRequestForRerunFailures

      private org.junit.platform.launcher.LauncherDiscoveryRequest buildLauncherDiscoveryRequestForRerunFailures(RunListenerAdapter adapter)
    • newFilters

      private org.junit.platform.engine.Filter<?>[] newFilters()
    • getFilters

      org.junit.platform.engine.Filter<?>[] getFilters()
    • newConfigurationParameters

      private Map<String,String> newConfigurationParameters()
    • getConfigurationParameters

      Map<String,String> getConfigurationParameters()
    • getPropertiesList

      private Optional<List<String>> getPropertiesList(String key)