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 aTestDescriptor
to an unspecified parent, usually the engine descriptor, by applying the suppliedFunction
to the new parent.<T extends TestDescriptor>
Optional<T> addToParent
(Supplier<DiscoverySelector> parentSelectorSupplier, Function<TestDescriptor, Optional<T>> creator) Add aTestDescriptor
to a parent, specified by theDiscoverySelector
returned by the suppliedSupplier
, by applying the suppliedFunction
to 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.Context
Add aTestDescriptor
to an unspecified parent, usually the engine descriptor, by applying the suppliedFunction
to 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
Function
is present, it will be added as a child of the parentTestDescriptor
unless a descriptor with the same unique ID was added earlier.- Specified by:
addToParent
in interfaceSelectorResolver.Context
- Type Parameters:
T
- the type of the newTestDescriptor
- Parameters:
creator
-Function
that will be called with the new parent to determine the newTestDescriptor
to be added; must not returnnull
- Returns:
- the new
TestDescriptor
or the previously existing one with the same unique ID; nevernull
but potentially empty
-
addToParent
public <T extends TestDescriptor> Optional<T> addToParent(Supplier<DiscoverySelector> parentSelectorSupplier, Function<TestDescriptor, Optional<T>> creator) Description copied from interface:SelectorResolver.Context
Add aTestDescriptor
to a parent, specified by theDiscoverySelector
returned by the suppliedSupplier
, by applying the suppliedFunction
to 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
, theDiscoverySelector
returned by the suppliedSupplier
will be used to determine the parent. If no parent is found, the suppliedFunction
will not be called. If there are multiple potential parents, an exception will be thrown. Otherwise, the resolvedTestDescriptor
will be used as the parent and passed to the suppliedFunction
.If the result of applying the
Function
is present, it will be added as a child of the parentTestDescriptor
unless a descriptor with the same unique ID was added earlier.- Specified by:
addToParent
in interfaceSelectorResolver.Context
- Type Parameters:
T
- the type of the newTestDescriptor
- Parameters:
creator
-Function
that will be called with the new parent to determine the newTestDescriptor
to be added; must not returnnull
- Returns:
- the new
TestDescriptor
or the previously existing one with the same unique ID; nevernull
but potentially empty
-
resolve
Description copied from interface:SelectorResolver.Context
Resolve the suppliedTestDescriptor
, if possible.Calling this method has the same effect as returning a partial match from a
SelectorResolver
: the children of the resultingTestDescriptor
will only be resolved if a subsequent resolution finds an exact match that contains aTestDescriptor
with the same unique ID.- Specified by:
resolve
in interfaceSelectorResolver.Context
- Parameters:
selector
- the selector to resolve- Returns:
- the resolved
TestDescriptor
; nevernull
but potentially empty
-
createAndAdd
private <T extends TestDescriptor> Optional<T> createAndAdd(TestDescriptor parent, Function<TestDescriptor, Optional<T>> creator)
-