use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.
the class ConsoleTestExecutor method executeTests.
private TestExecutionSummary executeTests(PrintWriter out) {
Launcher launcher = launcherSupplier.get();
SummaryGeneratingListener summaryListener = registerListeners(out, launcher);
LauncherDiscoveryRequest discoveryRequest = new DiscoveryRequestCreator().toDiscoveryRequest(options);
launcher.execute(discoveryRequest);
TestExecutionSummary summary = summaryListener.getSummary();
if (summary.getTotalFailureCount() > 0 || options.getDetails() != Details.NONE) {
printSummary(summary, out);
}
return summary;
}
use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.
the class JUnitPlatformRunnerTests method instantiateRunnerAndCaptureGeneratedRequest.
private LauncherDiscoveryRequest instantiateRunnerAndCaptureGeneratedRequest(Class<?> testClass) throws InitializationError {
Launcher launcher = mock(Launcher.class);
ArgumentCaptor<LauncherDiscoveryRequest> captor = ArgumentCaptor.forClass(LauncherDiscoveryRequest.class);
when(launcher.discover(captor.capture())).thenReturn(TestPlan.from(emptySet()));
new JUnitPlatform(testClass, launcher);
return captor.getValue();
}
use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.
the class DiscoveryRequestCreatorTests method convertsDefaultIncludeClassNamePatternOption.
@Test
void convertsDefaultIncludeClassNamePatternOption() {
options.setScanClasspath(true);
LauncherDiscoveryRequest request = convert();
List<ClassNameFilter> filter = request.getFiltersByType(ClassNameFilter.class);
assertThat(filter).hasSize(1);
assertThat(filter.get(0).toString()).contains(STANDARD_INCLUDE_PATTERN);
}
use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.
the class DiscoveryRequestCreatorTests method convertsScanClasspathOptionWithExplicitRootDirectories.
@Test
void convertsScanClasspathOptionWithExplicitRootDirectories() {
options.setScanClasspath(true);
options.setSelectedClasspathEntries(asList(Paths.get("."), Paths.get("..")));
LauncherDiscoveryRequest request = convert();
List<ClasspathRootSelector> classpathRootSelectors = request.getSelectorsByType(ClasspathRootSelector.class);
// @formatter:off
assertThat(classpathRootSelectors).extracting(ClasspathRootSelector::getClasspathRoot).containsExactly(new File(".").toURI(), new File("..").toURI());
// @formatter:on
}
use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.
the class DiscoveryRequestCreatorTests method convertsScanClasspathOptionWithAdditionalClasspathEntries.
@Test
void convertsScanClasspathOptionWithAdditionalClasspathEntries() {
options.setScanClasspath(true);
options.setAdditionalClasspathEntries(asList(Paths.get("."), Paths.get("..")));
LauncherDiscoveryRequest request = convert();
List<ClasspathRootSelector> classpathRootSelectors = request.getSelectorsByType(ClasspathRootSelector.class);
// @formatter:off
assertThat(classpathRootSelectors).extracting(ClasspathRootSelector::getClasspathRoot).contains(new File(".").toURI(), new File("..").toURI());
// @formatter:on
}
Aggregations