3939import static org .assertj .core .api .Assertions .assertThat ;
4040
4141/**
42- * Tests for {@link HealthEndpointAutoConfiguration} when running in a Cloud Foundry environment.
42+ * Tests for {@link HealthEndpointAutoConfiguration} when running in a Cloud Foundry
43+ * environment.
4344 *
4445 * This class isolates Cloud Foundry-specific behavior to avoid coupling such concerns
4546 * with general auto-configuration tests.
4950class CloudFoundryHealthEndpointConfigurationTests {
5051
5152 private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner ()
52- .withUserConfiguration (HealthIndicatorsConfiguration .class )
53- .withConfiguration (
54- AutoConfigurations .of (HealthContributorAutoConfiguration .class , HealthEndpointAutoConfiguration .class ));
53+ .withUserConfiguration (HealthIndicatorsConfiguration .class )
54+ .withConfiguration (
55+ AutoConfigurations .of (HealthContributorAutoConfiguration .class , HealthEndpointAutoConfiguration .class ));
5556
5657 private final ReactiveWebApplicationContextRunner reactiveContextRunner = new ReactiveWebApplicationContextRunner ()
57- .withUserConfiguration (HealthIndicatorsConfiguration .class )
58- .withConfiguration (
59- AutoConfigurations .of (HealthContributorAutoConfiguration .class , HealthEndpointAutoConfiguration .class ,
60- WebEndpointAutoConfiguration .class , EndpointAutoConfiguration .class ));
61-
58+ .withUserConfiguration (HealthIndicatorsConfiguration .class )
59+ .withConfiguration (
60+ AutoConfigurations .of (HealthContributorAutoConfiguration .class , HealthEndpointAutoConfiguration .class ,
61+ WebEndpointAutoConfiguration .class , EndpointAutoConfiguration .class ));
6262
6363 @ Test
6464 void additionalHealthEndpointsPathsTolerateHealthEndpointThatIsNotWebExposed () {
6565 this .contextRunner
66- .withConfiguration (AutoConfigurations .of (DispatcherServletAutoConfiguration .class ,
67- EndpointAutoConfiguration .class , WebEndpointAutoConfiguration .class ))
68- .withPropertyValues ("management.endpoints.web.exposure.exclude=*" ,
69- "management.endpoints.cloudfoundry.exposure.include=*" , "spring.main.cloud-platform=cloud_foundry" )
70- .run ((context ) -> {
71- assertThat (context ).hasSingleBean (MvcAdditionalHealthEndpointPathsConfiguration .class );
72- assertThat (context ).hasNotFailed ();
73- });
66+ .withConfiguration (AutoConfigurations .of (DispatcherServletAutoConfiguration .class ,
67+ EndpointAutoConfiguration .class , WebEndpointAutoConfiguration .class ))
68+ .withPropertyValues ("management.endpoints.web.exposure.exclude=*" ,
69+ "management.endpoints.cloudfoundry.exposure.include=*" , "spring.main.cloud-platform=cloud_foundry" )
70+ .run ((context ) -> {
71+ assertThat (context ).hasSingleBean (MvcAdditionalHealthEndpointPathsConfiguration .class );
72+ assertThat (context ).hasNotFailed ();
73+ });
7474 }
7575
7676 @ Test
7777 void additionalJerseyHealthEndpointsPathsTolerateHealthEndpointThatIsNotWebExposed () {
7878 this .contextRunner
79- .withConfiguration (
80- AutoConfigurations .of (EndpointAutoConfiguration .class , WebEndpointAutoConfiguration .class ))
81- .withClassLoader (new FilteredClassLoader (DispatcherServlet .class ))
82- .withPropertyValues ("management.endpoints.web.exposure.exclude=*" ,
83- "management.endpoints.cloudfoundry.exposure.include=*" , "spring.main.cloud-platform=cloud_foundry" )
84- .run ((context ) -> {
85- assertThat (context ).hasSingleBean (JerseyAdditionalHealthEndpointPathsConfiguration .class );
86- assertThat (context ).hasNotFailed ();
87- });
79+ .withConfiguration (
80+ AutoConfigurations .of (EndpointAutoConfiguration .class , WebEndpointAutoConfiguration .class ))
81+ .withClassLoader (new FilteredClassLoader (DispatcherServlet .class ))
82+ .withPropertyValues ("management.endpoints.web.exposure.exclude=*" ,
83+ "management.endpoints.cloudfoundry.exposure.include=*" , "spring.main.cloud-platform=cloud_foundry" )
84+ .run ((context ) -> {
85+ assertThat (context ).hasSingleBean (JerseyAdditionalHealthEndpointPathsConfiguration .class );
86+ assertThat (context ).hasNotFailed ();
87+ });
8888 }
8989
9090 @ Test
9191 void additionalReactiveHealthEndpointsPathsTolerateHealthEndpointThatIsNotWebExposed () {
9292 this .reactiveContextRunner
93- .withConfiguration (
94- AutoConfigurations .of (EndpointAutoConfiguration .class , WebEndpointAutoConfiguration .class ))
95- .withPropertyValues ("management.endpoints.web.exposure.exclude=*" ,
96- "management.endpoints.cloudfoundry.exposure.include=*" , "spring.main.cloud-platform=cloud_foundry" )
97- .run ((context ) -> {
98- assertThat (context ).hasSingleBean (WebFluxAdditionalHealthEndpointPathsConfiguration .class );
99- assertThat (context ).hasNotFailed ();
100- });
93+ .withConfiguration (
94+ AutoConfigurations .of (EndpointAutoConfiguration .class , WebEndpointAutoConfiguration .class ))
95+ .withPropertyValues ("management.endpoints.web.exposure.exclude=*" ,
96+ "management.endpoints.cloudfoundry.exposure.include=*" , "spring.main.cloud-platform=cloud_foundry" )
97+ .run ((context ) -> {
98+ assertThat (context ).hasSingleBean (WebFluxAdditionalHealthEndpointPathsConfiguration .class );
99+ assertThat (context ).hasNotFailed ();
100+ });
101101 }
102102
103103 @ Configuration (proxyBeanMethods = false )
@@ -119,4 +119,5 @@ ReactiveHealthIndicator reactiveHealthIndicator() {
119119 }
120120
121121 }
122+
122123}
0 commit comments