use of org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider in project junit5 by junit-team.
the class TestTemplateTestDescriptor method execute.
@Override
public JupiterEngineExecutionContext execute(JupiterEngineExecutionContext context, DynamicTestExecutor dynamicTestExecutor) throws Exception {
ExtensionContext extensionContext = context.getExtensionContext();
List<TestTemplateInvocationContextProvider> providers = validateProviders(extensionContext, context.getExtensionRegistry());
AtomicInteger invocationIndex = new AtomicInteger();
// @formatter:off
providers.stream().flatMap(provider -> provider.provideTestTemplateInvocationContexts(extensionContext)).map(invocationContext -> createInvocationTestDescriptor(invocationContext, invocationIndex.incrementAndGet())).filter(Optional::isPresent).map(Optional::get).forEach(invocationTestDescriptor -> execute(dynamicTestExecutor, invocationTestDescriptor));
// @formatter:on
validateWasAtLeastInvokedOnce(invocationIndex.get());
return context;
}
Aggregations