Class SelectorResolver.Match
- java.lang.Object
-
- org.junit.platform.engine.support.discovery.SelectorResolver.Match
-
- Enclosing interface:
- SelectorResolver
@API(status=EXPERIMENTAL, since="1.5") public static class SelectorResolver.Match extends java.lang.ObjectAn exact or partial match for resolving aDiscoverySelectorinto aTestDescriptor.A match is exact if the
DiscoverySelectordirectly represents the resultingTestDescriptor, e.g. if aClassSelectorwas resolved into theTestDescriptorthat represents the test class. It is partial if the matchingTestDescriptordoes not directly correspond to the resolvedDiscoverySelector, e.g. when resolving aUniqueIdSelectorthat represents a dynamic child of the resolvedTestDescriptor.In addition to the
TestDescriptor, a match may contain aSupplierofDiscoverySelectorsthat may be used to discover the children of theTestDescriptor. The algorithm implemented byEngineDiscoveryRequestResolverexpands all exact matches immediately, i.e. it resolves all of their children. Partial matches will only be expanded in case a subsequent resolution finds an exact match that contains aTestDescriptorwith the same unique ID.- Since:
- 1.5
- See Also:
SelectorResolver,SelectorResolver.Resolution.match(Match),SelectorResolver.Resolution.matches(Set)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSelectorResolver.Match.Type
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.Supplier<java.util.Set<? extends DiscoverySelector>>childSelectorsSupplierprivate TestDescriptortestDescriptorprivate SelectorResolver.Match.Typetype
-
Constructor Summary
Constructors Modifier Constructor Description privateMatch(TestDescriptor testDescriptor, java.util.function.Supplier<java.util.Set<? extends DiscoverySelector>> childSelectorsSupplier, SelectorResolver.Match.Type type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SelectorResolver.Matchexact(TestDescriptor testDescriptor)Factory for creating an exact match without any children.static SelectorResolver.Matchexact(TestDescriptor testDescriptor, java.util.function.Supplier<java.util.Set<? extends DiscoverySelector>> childSelectorsSupplier)Factory for creating an exact match with potential children.java.util.Set<? extends DiscoverySelector>expand()Expand this match in order to resolve the children of the containedTestDescriptor.TestDescriptorgetTestDescriptor()Get the containedTestDescriptor.booleanisExact()Whether this match is exact.static SelectorResolver.Matchpartial(TestDescriptor testDescriptor)Factory for creating a partial match without any children.static SelectorResolver.Matchpartial(TestDescriptor testDescriptor, java.util.function.Supplier<java.util.Set<? extends DiscoverySelector>> childSelectorsSupplier)Factory for creating a partial match with potential children.
-
-
-
Field Detail
-
testDescriptor
private final TestDescriptor testDescriptor
-
childSelectorsSupplier
private final java.util.function.Supplier<java.util.Set<? extends DiscoverySelector>> childSelectorsSupplier
-
type
private final SelectorResolver.Match.Type type
-
-
Constructor Detail
-
Match
private Match(TestDescriptor testDescriptor, java.util.function.Supplier<java.util.Set<? extends DiscoverySelector>> childSelectorsSupplier, SelectorResolver.Match.Type type)
-
-
Method Detail
-
exact
public static SelectorResolver.Match exact(TestDescriptor testDescriptor)
Factory for creating an exact match without any children.- Parameters:
testDescriptor- the resolvedTestDescriptor; nevernull- Returns:
- a match that contains the supplied
TestDescriptor; nevernull
-
exact
public static SelectorResolver.Match exact(TestDescriptor testDescriptor, java.util.function.Supplier<java.util.Set<? extends DiscoverySelector>> childSelectorsSupplier)
Factory for creating an exact match with potential children.- Parameters:
testDescriptor- the resolvedTestDescriptor; nevernullchildSelectorsSupplier- aSupplierof children selectors that will be resolved when this match is expanded; nevernull- Returns:
- a match that contains the supplied
TestDescriptor; nevernull
-
partial
public static SelectorResolver.Match partial(TestDescriptor testDescriptor)
Factory for creating a partial match without any children.- Parameters:
testDescriptor- the resolvedTestDescriptor; nevernull- Returns:
- a match that contains the supplied
TestDescriptor; nevernull
-
partial
public static SelectorResolver.Match partial(TestDescriptor testDescriptor, java.util.function.Supplier<java.util.Set<? extends DiscoverySelector>> childSelectorsSupplier)
Factory for creating a partial match with potential children.- Parameters:
testDescriptor- the resolvedTestDescriptor; nevernullchildSelectorsSupplier- aSupplierof children selectors that will be resolved when this match is expanded; nevernull- Returns:
- a match that contains the supplied
TestDescriptor; nevernull
-
isExact
public boolean isExact()
Whether this match is exact.- Returns:
trueif this match is exact;falseif it's partial
-
getTestDescriptor
public TestDescriptor getTestDescriptor()
Get the containedTestDescriptor.- Returns:
- the contained
TestDescriptor; nevernull
-
expand
public java.util.Set<? extends DiscoverySelector> expand()
Expand this match in order to resolve the children of the containedTestDescriptor.- Returns:
- the set of
DiscoverySelectorsthat represent the children of the containedTestDescriptor; nevernull
-
-