From d7941c63157c81a4aa89a983b84b2c3a75531bf4 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Sat, 5 Nov 2022 18:44:57 -0700 Subject: [PATCH] Polish --- ...verContainerInvocationContextProvider.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/intTest/java/org/springframework/boot/context/embedded/EmbeddedServerContainerInvocationContextProvider.java b/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/intTest/java/org/springframework/boot/context/embedded/EmbeddedServerContainerInvocationContextProvider.java index 5510d6b3b5c..d1c3170384b 100644 --- a/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/intTest/java/org/springframework/boot/context/embedded/EmbeddedServerContainerInvocationContextProvider.java +++ b/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/intTest/java/org/springframework/boot/context/embedded/EmbeddedServerContainerInvocationContextProvider.java @@ -83,17 +83,22 @@ class EmbeddedServerContainerInvocationContextProvider public Stream provideTestTemplateInvocationContexts(ExtensionContext context) { EmbeddedServletContainerTest annotation = context.getRequiredTestClass() .getAnnotation(EmbeddedServletContainerTest.class); - return CONTAINERS - .stream().map( - (container) -> getApplication(annotation, container)) - .flatMap( - (builder) -> Stream - .of(annotation.launchers()).map( - (launcherClass) -> getAbstractApplicationLauncher(builder, launcherClass)) - .map((launcher) -> new EmbeddedServletContainerInvocationContext( - StringUtils.capitalize(builder.getContainer()) + ": " - + launcher.getDescription(builder.getPackaging()), - launcher))); + return CONTAINERS.stream().map((container) -> getApplication(annotation, container)) + .flatMap((builder) -> provideTestTemplateInvocationContexts(annotation, builder)); + } + + private Stream provideTestTemplateInvocationContexts( + EmbeddedServletContainerTest annotation, Application application) { + return Stream.of(annotation.launchers()) + .map((launcherClass) -> getAbstractApplicationLauncher(application, launcherClass)) + .map((launcher) -> provideTestTemplateInvocationContext(application, launcher)); + } + + private EmbeddedServletContainerInvocationContext provideTestTemplateInvocationContext(Application application, + AbstractApplicationLauncher launcher) { + String name = StringUtils.capitalize(application.getContainer()) + ": " + + launcher.getDescription(application.getPackaging()); + return new EmbeddedServletContainerInvocationContext(name, launcher); } @Override