use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithClassPathUriSelectorWithLine.
@Test
void resolveRequestWithClassPathUriSelectorWithLine() {
URI uri = URI.create("classpath:/io/cucumber/junit/platform/engine/feature-with-outline.feature?line=20");
DiscoverySelector resource = selectUri(uri);
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
List<? extends TestDescriptor> tests = testDescriptor.getDescendants().stream().filter(TestDescriptor::isTest).collect(Collectors.toList());
assertEquals(1, tests.size());
}
use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithClasspathResourceSelector.
@Test
void resolveRequestWithClasspathResourceSelector() {
DiscoverySelector resource = selectClasspathResource("io/cucumber/junit/platform/engine/single.feature");
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
assertEquals(1, testDescriptor.getChildren().size());
}
use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithUriSelectorWithScenarioOutlineLine.
@Test
void resolveRequestWithUriSelectorWithScenarioOutlineLine() {
File file = new File("src/test/resources/io/cucumber/junit/platform/engine/feature-with-outline.feature");
URI uri = URI.create(file.toURI() + "?line=11");
DiscoverySelector resource = selectUri(uri);
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
List<? extends TestDescriptor> tests = testDescriptor.getDescendants().stream().filter(TestDescriptor::isTest).collect(Collectors.toList());
// 4 examples in the outline
assertEquals(4, tests.size());
}
use of org.junit.platform.engine.DiscoverySelector in project cucumber-jvm by cucumber.
the class DiscoverySelectorResolverTest method resolveRequestWithUniqueIdSelectorFromJarFileUri.
@Test
void resolveRequestWithUniqueIdSelectorFromJarFileUri() {
URI uri = new File("src/test/resources/feature.jar").toURI();
DiscoverySelector resource = selectUri(uri);
EngineDiscoveryRequest discoveryRequest = new SelectorRequest(resource);
resolver.resolveSelectors(discoveryRequest, testDescriptor);
assertEquals(1, testDescriptor.getChildren().size());
}
use of org.junit.platform.engine.DiscoverySelector in project gradle by gradle.
the class ToolingApiCurrentDiscoveryRequest method getSelectorsByType.
@Override
public <T extends DiscoverySelector> List<T> getSelectorsByType(Class<T> selectorType) {
if (selectorType.equals(ClassSelector.class)) {
return Cast.uncheckedCast(selectors);
}
if (selectorType.equals(DiscoverySelector.class)) {
List<DiscoverySelector> result = new ArrayList<DiscoverySelector>(delegate.getSelectorsByType(selectorType));
Iterator<DiscoverySelector> iterator = result.iterator();
while (iterator.hasNext()) {
DiscoverySelector selector = iterator.next();
if (selector instanceof ClassSelector) {
iterator.remove();
}
}
result.addAll(selectors);
return Cast.uncheckedCast(result);
}
return delegate.getSelectorsByType(selectorType);
}
Aggregations