Commit 9dccf5b8 authored by Stephane Nicoll's avatar Stephane Nicoll

Polish

See gh-13078
parent 6e428100
...@@ -20,10 +20,7 @@ import io.micrometer.core.instrument.binder.logging.LogbackMetrics; ...@@ -20,10 +20,7 @@ import io.micrometer.core.instrument.binder.logging.LogbackMetrics;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport;
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportMessage;
import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.boot.testsupport.runner.classpath.ClassPathOverrides; import org.springframework.boot.testsupport.runner.classpath.ClassPathOverrides;
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner; import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
...@@ -47,10 +44,6 @@ public class MetricsAutoConfigurationWithLog4j2AndLogbackTests { ...@@ -47,10 +44,6 @@ public class MetricsAutoConfigurationWithLog4j2AndLogbackTests {
@Test @Test
public void doesNotConfigureLogbackMetrics() { public void doesNotConfigureLogbackMetrics() {
this.contextRunner.run((context) -> { this.contextRunner.run((context) -> {
System.out.println(
new ConditionEvaluationReportMessage(ConditionEvaluationReport
.get((ConfigurableListableBeanFactory) context
.getAutowireCapableBeanFactory())));
assertThat(context).doesNotHaveBean(LogbackMetrics.class); assertThat(context).doesNotHaveBean(LogbackMetrics.class);
}); });
} }
......
...@@ -266,7 +266,7 @@ behalf. The algorithm used to determine a `WebEnvironmentType` is fairly simple: ...@@ -266,7 +266,7 @@ behalf. The algorithm used to determine a `WebEnvironmentType` is fairly simple:
* If Spring MVC is present, an `AnnotationConfigServletWebServerApplicationContext` is * If Spring MVC is present, an `AnnotationConfigServletWebServerApplicationContext` is
used used
* If Spring MVC is not present and Spring WebFlux is present, an * If Spring MVC is not present and Spring WebFlux is present, an
`AnnotationConfigReactiveWebApplicationContext` is used `AnnotationConfigReactiveWebServerApplicationContext` is used
* Otherwise, `AnnotationConfigApplicationContext` is used * Otherwise, `AnnotationConfigApplicationContext` is used
This means that if you are using Spring MVC and the new `WebClient` from Spring WebFlux in This means that if you are using Spring MVC and the new `WebClient` from Spring WebFlux in
......
...@@ -91,7 +91,6 @@ public class BuildInfoIntegrationTests { ...@@ -91,7 +91,6 @@ public class BuildInfoIntegrationTests {
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS); .getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
BuildResult result = this.gradleBuild.build("buildInfo", "-PnullTime", BuildResult result = this.gradleBuild.build("buildInfo", "-PnullTime",
"-PprojectVersion=0.2.0"); "-PprojectVersion=0.2.0");
System.out.println(result.getOutput());
assertThat(result.task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); assertThat(result.task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
} }
......
...@@ -57,7 +57,7 @@ public class ApplicationContextServerWebExchangeMatcherTests { ...@@ -57,7 +57,7 @@ public class ApplicationContextServerWebExchangeMatcherTests {
@Test @Test
public void matchesWhenContextClassIsApplicationContextShouldProvideContext() { public void matchesWhenContextClassIsApplicationContextShouldProvideContext() {
ServerWebExchange exchange = createHttpWebHandlerAdapter(); ServerWebExchange exchange = createExchange();
StaticApplicationContext context = (StaticApplicationContext) exchange StaticApplicationContext context = (StaticApplicationContext) exchange
.getApplicationContext(); .getApplicationContext();
assertThat(new TestApplicationContextServerWebExchangeMatcher<>( assertThat(new TestApplicationContextServerWebExchangeMatcher<>(
...@@ -67,7 +67,7 @@ public class ApplicationContextServerWebExchangeMatcherTests { ...@@ -67,7 +67,7 @@ public class ApplicationContextServerWebExchangeMatcherTests {
@Test @Test
public void matchesWhenContextClassIsExistingBeanShouldProvideBean() { public void matchesWhenContextClassIsExistingBeanShouldProvideBean() {
ServerWebExchange exchange = createHttpWebHandlerAdapter(); ServerWebExchange exchange = createExchange();
StaticApplicationContext context = (StaticApplicationContext) exchange StaticApplicationContext context = (StaticApplicationContext) exchange
.getApplicationContext(); .getApplicationContext();
context.registerSingleton("existingBean", ExistingBean.class); context.registerSingleton("existingBean", ExistingBean.class);
...@@ -79,7 +79,7 @@ public class ApplicationContextServerWebExchangeMatcherTests { ...@@ -79,7 +79,7 @@ public class ApplicationContextServerWebExchangeMatcherTests {
@Test @Test
public void matchesWhenContextClassIsMissingBeanShouldProvideException() { public void matchesWhenContextClassIsMissingBeanShouldProvideException() {
ServerWebExchange exchange = createHttpWebHandlerAdapter(); ServerWebExchange exchange = createExchange();
Supplier<ExistingBean> supplier = new TestApplicationContextServerWebExchangeMatcher<>( Supplier<ExistingBean> supplier = new TestApplicationContextServerWebExchangeMatcher<>(
ExistingBean.class).callMatchesAndReturnProvidedContext(exchange); ExistingBean.class).callMatchesAndReturnProvidedContext(exchange);
this.thrown.expect(NoSuchBeanDefinitionException.class); this.thrown.expect(NoSuchBeanDefinitionException.class);
...@@ -96,7 +96,7 @@ public class ApplicationContextServerWebExchangeMatcherTests { ...@@ -96,7 +96,7 @@ public class ApplicationContextServerWebExchangeMatcherTests {
.callMatchesAndReturnProvidedContext(exchange); .callMatchesAndReturnProvidedContext(exchange);
} }
private ServerWebExchange createHttpWebHandlerAdapter() { private ServerWebExchange createExchange() {
StaticApplicationContext context = new StaticApplicationContext(); StaticApplicationContext context = new StaticApplicationContext();
TestHttpWebHandlerAdapter adapter = new TestHttpWebHandlerAdapter( TestHttpWebHandlerAdapter adapter = new TestHttpWebHandlerAdapter(
mock(WebHandler.class)); mock(WebHandler.class));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment