formatting
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user