diff --git a/spring-cloud-gateway-integration-tests/mvc-failure-analyzer/src/main/java/org/springframework/cloud/gateway/sample/MvcFailureAnalyzerApplication.java b/spring-cloud-gateway-integration-tests/mvc-failure-analyzer/src/main/java/org/springframework/cloud/gateway/sample/MvcFailureAnalyzerApplication.java index 8bb621ef..295e8623 100644 --- a/spring-cloud-gateway-integration-tests/mvc-failure-analyzer/src/main/java/org/springframework/cloud/gateway/sample/MvcFailureAnalyzerApplication.java +++ b/spring-cloud-gateway-integration-tests/mvc-failure-analyzer/src/main/java/org/springframework/cloud/gateway/sample/MvcFailureAnalyzerApplication.java @@ -47,8 +47,8 @@ public class MvcFailureAnalyzerApplication { @Bean @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) public RouteLocator myRouteLocator(RouteLocatorBuilder builder) { - return builder.routes().route(r -> r.path("/myprefix/**") - .filters(f -> f.stripPrefix(1)).uri("lb://myservice")).build(); + return builder.routes().route(r -> r.path("/myprefix/**").filters(f -> f.stripPrefix(1)).uri("lb://myservice")) + .build(); } } @@ -60,8 +60,8 @@ class MyServiceConf { @Bean public ServiceInstanceListSupplier staticServiceInstanceListSupplier() { - return ServiceInstanceListSuppliers.from("myservice", new DefaultServiceInstance( - "myservice-1", "myservice", "localhost", port, false)); + return ServiceInstanceListSuppliers.from("myservice", + new DefaultServiceInstance("myservice-1", "myservice", "localhost", port, false)); } } diff --git a/spring-cloud-gateway-integration-tests/mvc-failure-analyzer/src/test/java/org/springframework/cloud/gateway/sample/MvcFailureAnalyzerApplicationTests.java b/spring-cloud-gateway-integration-tests/mvc-failure-analyzer/src/test/java/org/springframework/cloud/gateway/sample/MvcFailureAnalyzerApplicationTests.java index ed8c9b82..d6528f40 100644 --- a/spring-cloud-gateway-integration-tests/mvc-failure-analyzer/src/test/java/org/springframework/cloud/gateway/sample/MvcFailureAnalyzerApplicationTests.java +++ b/spring-cloud-gateway-integration-tests/mvc-failure-analyzer/src/test/java/org/springframework/cloud/gateway/sample/MvcFailureAnalyzerApplicationTests.java @@ -39,10 +39,8 @@ public class MvcFailureAnalyzerApplicationTests { @Test public void exceptionThrown(CapturedOutput output) { - assertThatThrownBy( - () -> new SpringApplication(MvcFailureAnalyzerApplication.class) - .run("--server.port=0")).hasRootCauseInstanceOf( - MvcFoundOnClasspathException.class); + assertThatThrownBy(() -> new SpringApplication(MvcFailureAnalyzerApplication.class).run("--server.port=0")) + .hasRootCauseInstanceOf(MvcFoundOnClasspathException.class); assertThat(output).contains(MvcFoundOnClasspathFailureAnalyzer.MESSAGE, MvcFoundOnClasspathFailureAnalyzer.ACTION); } @@ -50,8 +48,7 @@ public class MvcFailureAnalyzerApplicationTests { @Test public void exceptionNotThrownWhenDisabled(CapturedOutput output) { assertThatCode(() -> new SpringApplication(MvcFailureAnalyzerApplication.class) - .run("--spring.cloud.gateway.enabled=false", "--server.port=0")) - .doesNotThrowAnyException(); + .run("--spring.cloud.gateway.enabled=false", "--server.port=0")).doesNotThrowAnyException(); assertThat(output).doesNotContain(MvcFoundOnClasspathFailureAnalyzer.MESSAGE, MvcFoundOnClasspathFailureAnalyzer.ACTION); } @@ -59,16 +56,12 @@ public class MvcFailureAnalyzerApplicationTests { @Test public void exceptionNotThrownWhenReactiveTypeSet(CapturedOutput output) { assertThatCode(() -> { - ConfigurableApplicationContext context = new SpringApplication( - MvcFailureAnalyzerApplication.class).run( - "--spring.main.web-application-type=reactive", - "--server.port=0", "--debug=true"); - Integer port = context.getEnvironment().getProperty("local.server.port", - Integer.class); - WebTestClient client = WebTestClient.bindToServer() - .baseUrl("http://localhost:" + port).build(); - client.get().uri("/myprefix/hello").exchange().expectStatus().isOk() - .expectBody(String.class).isEqualTo("Hello"); + ConfigurableApplicationContext context = new SpringApplication(MvcFailureAnalyzerApplication.class) + .run("--spring.main.web-application-type=reactive", "--server.port=0", "--debug=true"); + Integer port = context.getEnvironment().getProperty("local.server.port", Integer.class); + WebTestClient client = WebTestClient.bindToServer().baseUrl("http://localhost:" + port).build(); + client.get().uri("/myprefix/hello").exchange().expectStatus().isOk().expectBody(String.class) + .isEqualTo("Hello"); context.close(); }).doesNotThrowAnyException(); assertThat(output).doesNotContain(MvcFoundOnClasspathFailureAnalyzer.MESSAGE,