This commit is contained in:
Phillip Webb 2022-11-05 18:44:57 -07:00
parent 3bd945766f
commit d7941c6315
1 changed files with 16 additions and 11 deletions

View File

@ -83,17 +83,22 @@ class EmbeddedServerContainerInvocationContextProvider
public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(ExtensionContext context) { public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(ExtensionContext context) {
EmbeddedServletContainerTest annotation = context.getRequiredTestClass() EmbeddedServletContainerTest annotation = context.getRequiredTestClass()
.getAnnotation(EmbeddedServletContainerTest.class); .getAnnotation(EmbeddedServletContainerTest.class);
return CONTAINERS return CONTAINERS.stream().map((container) -> getApplication(annotation, container))
.stream().map( .flatMap((builder) -> provideTestTemplateInvocationContexts(annotation, builder));
(container) -> getApplication(annotation, container)) }
.flatMap(
(builder) -> Stream private Stream<EmbeddedServletContainerInvocationContext> provideTestTemplateInvocationContexts(
.of(annotation.launchers()).map( EmbeddedServletContainerTest annotation, Application application) {
(launcherClass) -> getAbstractApplicationLauncher(builder, launcherClass)) return Stream.of(annotation.launchers())
.map((launcher) -> new EmbeddedServletContainerInvocationContext( .map((launcherClass) -> getAbstractApplicationLauncher(application, launcherClass))
StringUtils.capitalize(builder.getContainer()) + ": " .map((launcher) -> provideTestTemplateInvocationContext(application, launcher));
+ launcher.getDescription(builder.getPackaging()), }
launcher)));
private EmbeddedServletContainerInvocationContext provideTestTemplateInvocationContext(Application application,
AbstractApplicationLauncher launcher) {
String name = StringUtils.capitalize(application.getContainer()) + ": "
+ launcher.getDescription(application.getPackaging());
return new EmbeddedServletContainerInvocationContext(name, launcher);
} }
@Override @Override