Browse Source

formatting

pull/2223/head
spencergibb 4 years ago
parent
commit
dd020a341f
No known key found for this signature in database
GPG Key ID: 8EDA384E4974A9B0
  1. 8
      spring-cloud-gateway-integration-tests/mvc-failure-analyzer/src/main/java/org/springframework/cloud/gateway/sample/MvcFailureAnalyzerApplication.java
  2. 25
      spring-cloud-gateway-integration-tests/mvc-failure-analyzer/src/test/java/org/springframework/cloud/gateway/sample/MvcFailureAnalyzerApplicationTests.java

8
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 { @@ -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 { @@ -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));
}
}

25
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 { @@ -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 { @@ -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 { @@ -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,

Loading…
Cancel
Save