Class EngineDiscoveryRequestResolution.DefaultContext
- All Implemented Interfaces:
SelectorResolver.Context
- Enclosing class:
EngineDiscoveryRequestResolution
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends TestDescriptor>
Optional<T> addToParent(Function<TestDescriptor, Optional<T>> creator) Add aTestDescriptorto an unspecified parent, usually the engine descriptor, by applying the suppliedFunctionto the new parent.<T extends TestDescriptor>
Optional<T> addToParent(Supplier<DiscoverySelector> parentSelectorSupplier, Function<TestDescriptor, Optional<T>> creator) Add aTestDescriptorto a parent, specified by theDiscoverySelectorreturned by the suppliedSupplier, by applying the suppliedFunctionto the new parent.private <T extends TestDescriptor>
Optional<T> createAndAdd(TestDescriptor parent, Function<TestDescriptor, Optional<T>> creator) resolve(DiscoverySelector selector) Resolve the suppliedTestDescriptor, if possible.
-
Field Details
-
parent
-
-
Constructor Details
-
DefaultContext
DefaultContext(TestDescriptor parent)
-
-
Method Details
-
addToParent
public <T extends TestDescriptor> Optional<T> addToParent(Function<TestDescriptor, Optional<T>> creator) Description copied from interface:SelectorResolver.ContextAdd aTestDescriptorto an unspecified parent, usually the engine descriptor, by applying the suppliedFunctionto the new parent.The parent will be the engine descriptor unless another parent has already been determined, i.e. if the selector that is being resolved is the result of expanding a
SelectorResolver.Match.If the result of applying the
Functionis present, it will be added as a child of the parentTestDescriptorunless a descriptor with the same unique ID was added earlier.- Specified by:
addToParentin interfaceSelectorResolver.Context- Type Parameters:
T- the type of the newTestDescriptor- Parameters:
creator-Functionthat will be called with the new parent to determine the newTestDescriptorto be added; must not returnnull- Returns:
- the new
TestDescriptoror the previously existing one with the same unique ID; nevernullbut potentially empty
-
addToParent
public <T extends TestDescriptor> Optional<T> addToParent(Supplier<DiscoverySelector> parentSelectorSupplier, Function<TestDescriptor, Optional<T>> creator) Description copied from interface:SelectorResolver.ContextAdd aTestDescriptorto a parent, specified by theDiscoverySelectorreturned by the suppliedSupplier, by applying the suppliedFunctionto the new parent.Unless another parent has already been determined, i.e. if the selector that is being resolved is the result of expanding a
SelectorResolver.Match, theDiscoverySelectorreturned by the suppliedSupplierwill be used to determine the parent. If no parent is found, the suppliedFunctionwill not be called. If there are multiple potential parents, an exception will be thrown. Otherwise, the resolvedTestDescriptorwill be used as the parent and passed to the suppliedFunction.If the result of applying the
Functionis present, it will be added as a child of the parentTestDescriptorunless a descriptor with the same unique ID was added earlier.- Specified by:
addToParentin interfaceSelectorResolver.Context- Type Parameters:
T- the type of the newTestDescriptor- Parameters:
creator-Functionthat will be called with the new parent to determine the newTestDescriptorto be added; must not returnnull- Returns:
- the new
TestDescriptoror the previously existing one with the same unique ID; nevernullbut potentially empty
-
resolve
Description copied from interface:SelectorResolver.ContextResolve the suppliedTestDescriptor, if possible.Calling this method has the same effect as returning a partial match from a
SelectorResolver: the children of the resultingTestDescriptorwill only be resolved if a subsequent resolution finds an exact match that contains aTestDescriptorwith the same unique ID.- Specified by:
resolvein interfaceSelectorResolver.Context- Parameters:
selector- the selector to resolve- Returns:
- the resolved
TestDescriptor; nevernullbut potentially empty
-
createAndAdd
private <T extends TestDescriptor> Optional<T> createAndAdd(TestDescriptor parent, Function<TestDescriptor, Optional<T>> creator)
-