Search in sources :

Example 1 with DiscoverySelectors

use of org.junit.platform.engine.discovery.DiscoverySelectors in project cucumber-jvm by cucumber.

the class DiscoverySelectorResolverTest method resolveRequestWithMultipleUniqueIdSelector.

@Test
void resolveRequestWithMultipleUniqueIdSelector() {
    Set<UniqueId> selectors = new HashSet<>();
    DiscoverySelector resource = selectDirectory("src/test/resources/io/cucumber/junit/platform/engine/feature-with-outline.feature");
    selectSomePickle(resource).ifPresent(selectors::add);
    DiscoverySelector resource2 = selectDirectory("src/test/resources/io/cucumber/junit/platform/engine/single.feature");
    selectSomePickle(resource2).ifPresent(selectors::add);
    EngineDiscoveryRequest discoveryRequest = new SelectorRequest(selectors.stream().map(DiscoverySelectors::selectUniqueId).collect(Collectors.toList()));
    resolver.resolveSelectors(discoveryRequest, testDescriptor);
    assertEquals(selectors, testDescriptor.getDescendants().stream().filter(PickleDescriptor.class::isInstance).map(TestDescriptor::getUniqueId).collect(toSet()));
}
Also used : UniqueId(org.junit.platform.engine.UniqueId) DiscoverySelectors.selectUniqueId(org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId) DiscoverySelector(org.junit.platform.engine.DiscoverySelector) EngineDiscoveryRequest(org.junit.platform.engine.EngineDiscoveryRequest) TestDescriptor(org.junit.platform.engine.TestDescriptor) HashSet(java.util.HashSet) DiscoverySelectors(org.junit.platform.engine.discovery.DiscoverySelectors) Test(org.junit.jupiter.api.Test)

Aggregations

HashSet (java.util.HashSet)1 Test (org.junit.jupiter.api.Test)1 DiscoverySelector (org.junit.platform.engine.DiscoverySelector)1 EngineDiscoveryRequest (org.junit.platform.engine.EngineDiscoveryRequest)1 TestDescriptor (org.junit.platform.engine.TestDescriptor)1 UniqueId (org.junit.platform.engine.UniqueId)1 DiscoverySelectors (org.junit.platform.engine.discovery.DiscoverySelectors)1 DiscoverySelectors.selectUniqueId (org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId)1