use of org.junit.platform.engine.FilterResult in project junit5 by junit-team.
the class TestMethodFilterTests method includesTestDescriptorWithClassSource.
@Test
void includesTestDescriptorWithClassSource() throws Exception {
FilterResult result = filter.apply(newClassTestDescriptor());
assertTrue(result.included());
assertFalse(result.excluded());
}
use of org.junit.platform.engine.FilterResult in project junit5 by junit-team.
the class DefaultLauncher method discoverRoot.
private Root discoverRoot(LauncherDiscoveryRequest discoveryRequest, String phase) {
Root root = new Root();
for (TestEngine testEngine : this.testEngines) {
// @formatter:off
boolean engineIsExcluded = discoveryRequest.getEngineFilters().stream().map(engineFilter -> engineFilter.apply(testEngine)).anyMatch(FilterResult::excluded);
if (engineIsExcluded) {
logger.debug(() -> String.format("Test discovery for engine '%s' was skipped due to an EngineFilter in phase '%s'.", testEngine.getId(), phase));
continue;
}
logger.debug(() -> String.format("Discovering tests during Launcher %s phase in engine '%s'.", phase, testEngine.getId()));
Optional<TestDescriptor> engineRoot = discoverEngineRoot(testEngine, discoveryRequest);
engineRoot.ifPresent(rootDescriptor -> root.add(testEngine, rootDescriptor));
}
root.applyPostDiscoveryFilters(discoveryRequest);
root.prune();
return root;
}
use of org.junit.platform.engine.FilterResult in project junit5 by junit-team.
the class TestMethodFilterTests method includesBasedOnTestListResolver.
@Test
void includesBasedOnTestListResolver() throws Exception {
when(resolver.shouldRun(toClassFileName(TestClass.class), "testMethod")).thenReturn(true);
FilterResult result = filter.apply(newTestMethodDescriptor());
assertTrue(result.included());
assertFalse(result.excluded());
}
use of org.junit.platform.engine.FilterResult in project junit5 by junit-team.
the class TestMethodFilterTests method excludesBasedOnTestListResolver.
@Test
void excludesBasedOnTestListResolver() throws Exception {
when(resolver.shouldRun(toClassFileName(TestClass.class), "testMethod")).thenReturn(false);
FilterResult result = filter.apply(newTestMethodDescriptor());
assertFalse(result.included());
assertTrue(result.excluded());
}
Aggregations