From 5ef29653c713dc446b70974edc65a4452d8daad4 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 31 May 2017 15:02:33 +0100 Subject: [PATCH] Polish --- .../AutoConfigurationReportEndpoint.java | 3 +- .../actuate/endpoint/TomcatPublicMetrics.java | 3 +- .../BootCuriesHrefIntegrationTests.java | 14 +- .../EndpointAutoConfigurationTests.java | 3 +- .../EndpointWebMvcAutoConfigurationTests.java | 145 +++++++++------- ...iaManagementContextConfigurationTests.java | 20 +-- ...vcManagementContextConfigurationTests.java | 7 +- ...HealthIndicatorAutoConfigurationTests.java | 160 ++++++++++-------- ...althMvcEndpointAutoConfigurationTests.java | 6 +- .../JolokiaAutoConfigurationTests.java | 8 +- ...mentWebSecurityAutoConfigurationTests.java | 3 +- .../MetricExportAutoConfigurationTests.java | 4 +- .../MetricFilterAutoConfigurationTests.java | 13 +- .../MvcEndpointPathConfigurationTests.java | 9 +- ...FoundryActuatorAutoConfigurationTests.java | 26 +-- ...sReportEndpointMethodAnnotationsTests.java | 5 +- ...rtiesReportEndpointSerializationTests.java | 4 +- ...gurationPropertiesReportEndpointTests.java | 18 +- .../endpoint/EnvironmentEndpointTests.java | 25 +-- .../mvc/EnvironmentMvcEndpointTests.java | 10 +- ...vcEndpointBrowserPathIntegrationTests.java | 5 +- ...erMvcEndpointDisabledIntegrationTests.java | 5 +- ...MvcEndpointServerPortIntegrationTests.java | 4 +- ...serMvcEndpointVanillaIntegrationTests.java | 9 +- .../endpoint/mvc/HalJsonMvcEndpointTests.java | 10 +- .../mvc/HeapdumpMvcEndpointTests.java | 10 +- .../endpoint/mvc/InfoMvcEndpointTests.java | 6 +- .../JolokiaMvcEndpointContextPathTests.java | 3 +- .../JolokiaMvcEndpointIntegrationTests.java | 6 +- .../mvc/MvcEndpointCorsIntegrationTests.java | 48 +++--- .../mvc/MvcEndpointIntegrationTests.java | 29 ++-- .../endpoint/mvc/MvcEndpointsTests.java | 5 +- ...rityHealthMvcEndpointIntegrationTests.java | 3 +- .../info/EnvironmentInfoContributorTests.java | 7 +- .../export/MetricCopyExporterTests.java | 3 +- .../batch/BatchConfigurerConfiguration.java | 3 +- .../jooq/JooqAutoConfiguration.java | 3 +- .../quartz/QuartzAutoConfiguration.java | 7 +- .../validation/ValidatorAdapter.java | 5 +- .../HttpHandlerAutoConfiguration.java | 3 +- .../ReactiveWebServerAutoConfiguration.java | 2 +- .../batch/BatchAutoConfigurationTests.java | 28 +-- ...BatchAutoConfigurationWithoutJpaTests.java | 24 +-- .../MessageSourceAutoConfigurationTests.java | 4 +- ...tionTranslationAutoConfigurationTests.java | 8 +- ...DataAutoConfigurationIntegrationTests.java | 7 +- .../CassandraDataAutoConfigurationTests.java | 11 +- .../ElasticsearchAutoConfigurationTests.java | 27 +-- ...asticsearchDataAutoConfigurationTests.java | 18 +- ...rchRepositoriesAutoConfigurationTests.java | 4 +- .../ldap/LdapDataAutoConfigurationTests.java | 4 +- ...dapRepositoriesAutoConfigurationTests.java | 4 +- ...ngoRepositoriesAutoConfigurationTests.java | 19 +-- .../MongoDataAutoConfigurationTests.java | 7 +- ...ingRepositoriesAutoConfigurationTests.java | 3 +- ...o4jRepositoriesAutoConfigurationTests.java | 4 +- .../SpringDataWebAutoConfigurationTests.java | 3 +- .../flyway/FlywayAutoConfigurationTests.java | 41 ++--- .../GroovyTemplateAutoConfigurationTests.java | 6 +- .../h2/H2ConsoleAutoConfigurationTests.java | 26 +-- .../HypermediaAutoConfigurationTests.java | 12 +- ...ssageConvertersAutoConfigurationTests.java | 4 +- .../JacksonAutoConfigurationTests.java | 85 +++++----- .../DataSourceAutoConfigurationTests.java | 51 +++--- .../jdbc/DataSourceInitializerTests.java | 78 ++++----- ...nsactionManagerAutoConfigurationTests.java | 7 +- .../HikariDataSourceConfigurationTests.java | 12 +- ...iverConfigurationFailureAnalyzerTests.java | 9 +- .../JdbcTemplateAutoConfigurationTests.java | 6 +- .../JndiDataSourceAutoConfigurationTests.java | 11 +- .../TomcatDataSourceConfigurationTests.java | 17 +- .../jooq/JooqAutoConfigurationTests.java | 3 +- .../jooq/JooqExceptionTranslatorTests.java | 2 +- .../jooq/SqlDialectLookupTests.java | 3 +- .../EmbeddedLdapAutoConfigurationTests.java | 8 +- .../LiquibaseAutoConfigurationTests.java | 42 ++--- .../SitePreferenceAutoConfigurationTests.java | 14 +- .../mongo/MongoAutoConfigurationTests.java | 10 +- .../MongoReactiveAutoConfigurationTests.java | 10 +- .../EmbeddedMongoAutoConfigurationTests.java | 8 +- .../MustacheAutoConfigurationTests.java | 55 +++--- .../AbstractJpaAutoConfigurationTests.java | 10 +- ...tomHibernateJpaAutoConfigurationTests.java | 18 +- .../HibernateJpaAutoConfigurationTests.java | 33 ++-- .../quartz/QuartzAutoConfigurationTests.java | 13 +- .../SecurityAutoConfigurationTests.java | 13 +- ...ConfigurationEarlyInitializationTests.java | 4 +- .../oauth2/OAuth2AutoConfigurationTests.java | 43 ++--- ...tipleResourceServerConfigurationTests.java | 3 +- ...ServerTokenServicesConfigurationTests.java | 68 ++++---- .../FacebookAutoConfigurationTests.java | 7 +- .../LinkedInAutoConfigurationTests.java | 7 +- .../social/TwitterAutoConfigurationTests.java | 7 +- .../jta/JtaAutoConfigurationTests.java | 48 +++--- .../validation/ValidatorAdapterTests.java | 5 +- ...spatcherServletAutoConfigurationTests.java | 3 +- .../FilterOrderingIntegrationTests.java | 3 +- .../MultipartAutoConfigurationTests.java | 8 +- ...ebServerFactoryAutoConfigurationTests.java | 7 +- .../servlet/WebMvcAutoConfigurationTests.java | 20 ++- ...SocketMessagingAutoConfigurationTests.java | 9 +- ...SpringApplicationAdminMXBeanRegistrar.java | 5 +- .../OriginTrackedSystemPropertySource.java | 4 +- ...ropertySourceEnvironmentPostProcessor.java | 34 ++-- .../boot/env/YamlPropertySourceLoader.java | 3 +- .../boot/origin/SystemEnvironmentOrigin.java | 1 - .../boot/origin/TextResourceOrigin.java | 4 +- .../web/embedded/netty/NettyWebServer.java | 2 +- .../tomcat/TomcatEmbeddedContext.java | 4 +- ...figServletWebServerApplicationContext.java | 18 +- .../ServletWebServerInitializedEvent.java | 4 +- ...XmlServletWebServerApplicationContext.java | 22 ++- ...gApplicationAdminMXBeanRegistrarTests.java | 5 +- .../context/properties/bind/BinderTests.java | 9 +- .../NoSnakeYamlPropertySourceLoaderTests.java | 4 +- .../OriginTrackedPropertiesLoaderTests.java | 3 +- .../env/OriginTrackedYamlLoaderTests.java | 3 +- ...tySourceEnvironmentPostProcessorTests.java | 18 +- .../jta/atomikos/AtomikosPropertiesTests.java | 5 +- .../origin/SystemEnvironmentOriginTests.java | 3 +- 120 files changed, 964 insertions(+), 873 deletions(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpoint.java index 8f3a918ef4..313a23d605 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpoint.java @@ -65,7 +65,8 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint { /** * Adapts {@link ConditionEvaluationReport} to a JSON friendly structure. */ - @JsonPropertyOrder({ "positiveMatches", "negativeMatches", "exclusions", "unconditionalClasses" }) + @JsonPropertyOrder({ "positiveMatches", "negativeMatches", "exclusions", + "unconditionalClasses" }) @JsonInclude(Include.NON_EMPTY) public static class Report { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java index 166004f523..a27af6ef6d 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java @@ -66,8 +66,7 @@ public class TomcatPublicMetrics implements PublicMetrics, ApplicationContextAwa } private Manager getManager(TomcatWebServer webServer) { - for (Container container : webServer.getTomcat().getHost() - .findChildren()) { + for (Container container : webServer.getTomcat().getHost().findChildren()) { if (container instanceof Context) { return ((Context) container).getManager(); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/BootCuriesHrefIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/BootCuriesHrefIntegrationTests.java index 17133b3f9c..f263acc9a9 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/BootCuriesHrefIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/BootCuriesHrefIntegrationTests.java @@ -49,8 +49,9 @@ public class BootCuriesHrefIntegrationTests { @Test public void basicCuriesHref() { int port = load("endpoints.docs.curies.enabled:true", "server.port:0"); - assertThat(getCurieHref("http://localhost:" + port + "/application")).isEqualTo( - "http://localhost:" + port + "/application/docs/#spring_boot_actuator__{rel}"); + assertThat(getCurieHref("http://localhost:" + port + "/application")) + .isEqualTo("http://localhost:" + port + + "/application/docs/#spring_boot_actuator__{rel}"); } @Test @@ -75,8 +76,8 @@ public class BootCuriesHrefIntegrationTests { public void curiesHrefWithCustomServletAndContextPaths() { int port = load("endpoints.docs.curies.enabled:true", "server.port:0", "server.servlet.context-path:/context", "server.servlet.path:/servlet"); - assertThat(getCurieHref("http://localhost:" + port + "/context/servlet/application")) - .isEqualTo("http://localhost:" + port + assertThat(getCurieHref("http://localhost:" + port + + "/context/servlet/application")).isEqualTo("http://localhost:" + port + "/context/servlet/application/docs/#spring_boot_actuator__{rel}"); } @@ -95,8 +96,9 @@ public class BootCuriesHrefIntegrationTests { int port = load("endpoints.docs.curies.enabled:true", "server.port:0", "server.servlet.context-path:/context", "server.servlet.path:/servlet", "management.port:0"); - assertThat(getCurieHref("http://localhost:" + port + "/application/")).isEqualTo( - "http://localhost:" + port + "/application/docs/#spring_boot_actuator__{rel}"); + assertThat(getCurieHref("http://localhost:" + port + "/application/")) + .isEqualTo("http://localhost:" + port + + "/application/docs/#spring_boot_actuator__{rel}"); } @Test diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java index e30b4fb818..668167341f 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java @@ -186,7 +186,8 @@ public class EndpointAutoConfigurationTests { @Test public void testInfoEndpointNoGitProperties() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of("spring.info.git.location:classpath:nonexistent").applyTo(this.context); + TestPropertyValues.of("spring.info.git.location:classpath:nonexistent") + .applyTo(this.context); this.context.register(InfoContributorAutoConfiguration.class, EndpointAutoConfiguration.class); this.context.refresh(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java index 50a56c5214..42ab3033f5 100755 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java @@ -124,9 +124,11 @@ public class EndpointWebMvcAutoConfigurationTests { public void setUp() { Ports values = new Ports(); ports.set(values); - TestPropertyValues.of( - "management.context-path=", "management.security.enabled=false", - "server.servlet.context-path=", "server.port=" + ports.get().server).applyTo(this.applicationContext); + TestPropertyValues + .of("management.context-path=", "management.security.enabled=false", + "server.servlet.context-path=", + "server.port=" + ports.get().server) + .applyTo(this.applicationContext); } @After @@ -137,8 +139,8 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void onSamePort() throws Exception { - TestPropertyValues.of( - "management.security.enabled=false").applyTo(this.applicationContext); + TestPropertyValues.of("management.security.enabled=false") + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class); this.applicationContext.refresh(); @@ -154,8 +156,8 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void onSamePortWithHeader() throws Exception { - TestPropertyValues.of( - "management.add-application-context-header:true").applyTo(this.applicationContext); + TestPropertyValues.of("management.add-application-context-header:true") + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class); this.applicationContext.refresh(); @@ -167,8 +169,8 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void onDifferentPort() throws Exception { - TestPropertyValues.of( - "management.port=" + ports.get().management).applyTo(this.applicationContext); + TestPropertyValues.of("management.port=" + ports.get().management) + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, DifferentPortConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); @@ -187,8 +189,8 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void onDifferentPortWithSpecificServer() throws Exception { - TestPropertyValues.of( - "management.port=" + ports.get().management).applyTo(this.applicationContext); + TestPropertyValues.of("management.port=" + ports.get().management) + .applyTo(this.applicationContext); this.applicationContext.register(SpecificWebServerConfig.class, RootConfig.class, DifferentPortConfig.class, EndpointConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); @@ -214,9 +216,10 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void onDifferentPortAndContext() throws Exception { - TestPropertyValues.of( - "management.port=" + ports.get().management, - "management.context-path=/admin").applyTo(this.applicationContext); + TestPropertyValues + .of("management.port=" + ports.get().management, + "management.context-path=/admin") + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, DifferentPortConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); @@ -228,10 +231,11 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void onDifferentPortAndMainContext() throws Exception { - TestPropertyValues.of( - "server.servlet.context-path=/spring", - "management.port=" + ports.get().management, - "management.context-path=/admin").applyTo(this.applicationContext); + TestPropertyValues + .of("server.servlet.context-path=/spring", + "management.port=" + ports.get().management, + "management.context-path=/admin") + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, DifferentPortConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); @@ -243,8 +247,8 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void onDifferentPortWithoutErrorMvcAutoConfiguration() throws Exception { - TestPropertyValues.of( - "management.port=" + ports.get().management).applyTo(this.applicationContext); + TestPropertyValues.of("management.port=" + ports.get().management) + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, DifferentPortConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class); @@ -254,8 +258,8 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void onDifferentPortInWebServer() throws Exception { - TestPropertyValues.of( - "management.port=" + ports.get().management).applyTo(this.applicationContext); + TestPropertyValues.of("management.port=" + ports.get().management) + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, DifferentPortConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); @@ -272,8 +276,8 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void onRandomPort() throws Exception { - TestPropertyValues.of("management.port=0", - "management.security.enabled=false").applyTo(this.applicationContext); + TestPropertyValues.of("management.port=0", "management.security.enabled=false") + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); @@ -291,8 +295,8 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void onDifferentPortWithPrimaryFailure() throws Exception { - TestPropertyValues.of( - "management.port=" + ports.get().management).applyTo(this.applicationContext); + TestPropertyValues.of("management.port=" + ports.get().management) + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, DifferentPortConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); @@ -320,10 +324,11 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void specificPortsViaProperties() throws Exception { - TestPropertyValues.of( - "server.port:" + ports.get().server, - "management.port:" + ports.get().management, - "management.security.enabled:false").applyTo(this.applicationContext); + TestPropertyValues + .of("server.port:" + ports.get().server, + "management.port:" + ports.get().management, + "management.security.enabled:false") + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); @@ -339,8 +344,10 @@ public class EndpointWebMvcAutoConfigurationTests { int managementPort = ports.get().management; try (ServerSocket serverSocket = new ServerSocket()) { serverSocket.bind(new InetSocketAddress(managementPort)); - TestPropertyValues.of("server.port:" + ports.get().server, - "management.port:" + ports.get().management).applyTo(this.applicationContext); + TestPropertyValues + .of("server.port:" + ports.get().server, + "management.port:" + ports.get().management) + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); @@ -351,7 +358,9 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void contextPath() throws Exception { - TestPropertyValues.of("management.context-path:/test", "management.security.enabled:false").applyTo(this.applicationContext); + TestPropertyValues + .of("management.context-path:/test", "management.security.enabled:false") + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, PropertyPlaceholderAutoConfiguration.class, JacksonAutoConfiguration.class, @@ -366,8 +375,7 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void overrideServerProperties() throws Exception { - TestPropertyValues.of( - "server.displayName:foo").applyTo(this.applicationContext); + TestPropertyValues.of("server.displayName:foo").applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, PropertyPlaceholderAutoConfiguration.class, JacksonAutoConfiguration.class, @@ -400,8 +408,8 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void portPropertiesOnDifferentPort() throws Exception { - TestPropertyValues.of( - "management.port=" + ports.get().management).applyTo(this.applicationContext); + TestPropertyValues.of("management.port=" + ports.get().management) + .applyTo(this.applicationContext); new ServerPortInfoApplicationContextInitializer() .initialize(this.applicationContext); this.applicationContext.register(RootConfig.class, DifferentPortConfig.class, @@ -441,8 +449,7 @@ public class EndpointWebMvcAutoConfigurationTests { public void endpointsAllDisabled() throws Exception { this.applicationContext.register(RootConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class); - TestPropertyValues.of( - "endpoints.enabled:false").applyTo(this.applicationContext); + TestPropertyValues.of("endpoints.enabled:false").applyTo(this.applicationContext); this.applicationContext.refresh(); assertThat(this.applicationContext.getBeansOfType(MvcEndpoint.class)).isEmpty(); } @@ -491,8 +498,8 @@ public class EndpointWebMvcAutoConfigurationTests { public void shutdownEndpointEnabled() { this.applicationContext.register(RootConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class); - TestPropertyValues.of( - "endpoints.shutdown.enabled:true").applyTo(this.applicationContext); + TestPropertyValues.of("endpoints.shutdown.enabled:true") + .applyTo(this.applicationContext); this.applicationContext.refresh(); assertThat(this.applicationContext.getBeansOfType(ShutdownMvcEndpoint.class)) .hasSize(1); @@ -502,7 +509,9 @@ public class EndpointWebMvcAutoConfigurationTests { public void actuatorEndpointEnabledIndividually() { this.applicationContext.register(RootConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class); - TestPropertyValues.of("endpoints.enabled:false", "endpoints.actuator.enabled:true").applyTo(this.applicationContext); + TestPropertyValues + .of("endpoints.enabled:false", "endpoints.actuator.enabled:true") + .applyTo(this.applicationContext); this.applicationContext.refresh(); assertThat(this.applicationContext.getBeansOfType(HalJsonMvcEndpoint.class)) .hasSize(1); @@ -510,10 +519,12 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void managementSpecificSslUsingDifferentPort() throws Exception { - TestPropertyValues.of("management.port=" + ports.get().management, - "management.ssl.enabled=true", - "management.ssl.key-store=classpath:test.jks", - "management.ssl.key-password=password").applyTo(this.applicationContext); + TestPropertyValues + .of("management.port=" + ports.get().management, + "management.ssl.enabled=true", + "management.ssl.key-store=classpath:test.jks", + "management.ssl.key-password=password") + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, DifferentPortConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); @@ -536,10 +547,11 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void managementSpecificSslUsingSamePortFails() throws Exception { - TestPropertyValues.of( - "management.ssl.enabled=true", - "management.ssl.key-store=classpath:test.jks", - "management.ssl.key-password=password").applyTo(this.applicationContext); + TestPropertyValues + .of("management.ssl.enabled=true", + "management.ssl.key-store=classpath:test.jks", + "management.ssl.key-password=password") + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); @@ -551,10 +563,10 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void managementServerCanDisableSslWhenUsingADifferentPort() throws Exception { - TestPropertyValues.of( - "management.port=" + ports.get().management, "server.ssl.enabled=true", - "server.ssl.key-store=classpath:test.jks", - "server.ssl.key-password=password", "management.ssl.enabled=false").applyTo(this.applicationContext); + TestPropertyValues.of("management.port=" + ports.get().management, + "server.ssl.enabled=true", "server.ssl.key-store=classpath:test.jks", + "server.ssl.key-password=password", "management.ssl.enabled=false") + .applyTo(this.applicationContext); this.applicationContext.register(RootConfig.class, EndpointConfig.class, DifferentPortConfig.class, BaseConfiguration.class, @@ -578,13 +590,13 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void tomcatManagementAccessLogUsesCustomPrefix() throws Exception { - TestPropertyValues.of( - "management.port=" + ports.get().management).applyTo(this.applicationContext); + TestPropertyValues.of("management.port=" + ports.get().management) + .applyTo(this.applicationContext); this.applicationContext.register(TomcatWebServerConfig.class, RootConfig.class, EndpointConfig.class, DifferentPortConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); - TestPropertyValues.of( - "server.tomcat.accesslog.enabled: true").applyTo(this.applicationContext); + TestPropertyValues.of("server.tomcat.accesslog.enabled: true") + .applyTo(this.applicationContext); this.applicationContext.refresh(); ApplicationContext managementContext = this.applicationContext .getBean(ManagementContextResolver.class).getApplicationContext(); @@ -599,9 +611,10 @@ public class EndpointWebMvcAutoConfigurationTests { @Test public void undertowManagementAccessLogUsesCustomPrefix() throws Exception { - TestPropertyValues.of( - "management.port=" + ports.get().management, - "server.undertow.accesslog.enabled: true").applyTo(this.applicationContext); + TestPropertyValues + .of("management.port=" + ports.get().management, + "server.undertow.accesslog.enabled: true") + .applyTo(this.applicationContext); this.applicationContext.register(UndertowWebServerConfig.class, RootConfig.class, EndpointConfig.class, DifferentPortConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); @@ -628,7 +641,8 @@ public class EndpointWebMvcAutoConfigurationTests { private void endpointDisabled(String name, Class type) { this.applicationContext.register(RootConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class); - TestPropertyValues.of(String.format("endpoints.%s.enabled:false", name)).applyTo(this.applicationContext); + TestPropertyValues.of(String.format("endpoints.%s.enabled:false", name)) + .applyTo(this.applicationContext); this.applicationContext.refresh(); assertThat(this.applicationContext.getBeansOfType(type)).isEmpty(); } @@ -638,9 +652,10 @@ public class EndpointWebMvcAutoConfigurationTests { this.applicationContext.register(LoggingConfig.class, RootConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class); ConfigurationPropertySources.attach(this.applicationContext.getEnvironment()); - TestPropertyValues.of( - "endpoints.enabled:false", - String.format("endpoints.%s.enabled:true", name)).applyTo(this.applicationContext); + TestPropertyValues + .of("endpoints.enabled:false", + String.format("endpoints.%s.enabled:true", name)) + .applyTo(this.applicationContext); this.applicationContext.refresh(); assertThat(this.applicationContext.getBeansOfType(type)).hasSize(1); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfigurationTests.java index 142780b6e3..47d0a145b6 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfigurationTests.java @@ -79,37 +79,37 @@ public class EndpointWebMvcHypermediaManagementContextConfigurationTests { @Test public void curiesEnabledWithDefaultPorts() { load("endpoints.docs.curies.enabled:true"); - assertThat(getCurieHref()) - .isEqualTo("http://localhost/application/docs/#spring_boot_actuator__{rel}"); + assertThat(getCurieHref()).isEqualTo( + "http://localhost/application/docs/#spring_boot_actuator__{rel}"); } @Test public void curiesEnabledWithRandomPorts() { load("endpoints.docs.curies.enabled:true", "server.port:0", "management.port:0"); - assertThat(getCurieHref()) - .isEqualTo("http://localhost/application/docs/#spring_boot_actuator__{rel}"); + assertThat(getCurieHref()).isEqualTo( + "http://localhost/application/docs/#spring_boot_actuator__{rel}"); } @Test public void curiesEnabledWithSpecificServerPort() { load("endpoints.docs.curies.enabled:true", "server.port:8080"); - assertThat(getCurieHref()) - .isEqualTo("http://localhost/application/docs/#spring_boot_actuator__{rel}"); + assertThat(getCurieHref()).isEqualTo( + "http://localhost/application/docs/#spring_boot_actuator__{rel}"); } @Test public void curiesEnabledWithSpecificManagementPort() { load("endpoints.docs.curies.enabled:true", "management.port:8081"); - assertThat(getCurieHref()) - .isEqualTo("http://localhost/application/docs/#spring_boot_actuator__{rel}"); + assertThat(getCurieHref()).isEqualTo( + "http://localhost/application/docs/#spring_boot_actuator__{rel}"); } @Test public void curiesEnabledWithSpecificManagementAndServerPorts() { load("endpoints.docs.curies.enabled:true", "server.port:8080", "management.port:8081"); - assertThat(getCurieHref()) - .isEqualTo("http://localhost/application/docs/#spring_boot_actuator__{rel}"); + assertThat(getCurieHref()).isEqualTo( + "http://localhost/application/docs/#spring_boot_actuator__{rel}"); } private void load(String... properties) { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcManagementContextConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcManagementContextConfigurationTests.java index 544285eb29..786c3d4fd8 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcManagementContextConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcManagementContextConfigurationTests.java @@ -68,9 +68,10 @@ public class EndpointWebMvcManagementContextConfigurationTests { @Test public void endpointHandlerMapping() throws Exception { - TestPropertyValues.of( - "management.security.enabled=false", - "management.security.roles=my-role,your-role").applyTo(this.context); + TestPropertyValues + .of("management.security.enabled=false", + "management.security.roles=my-role,your-role") + .applyTo(this.context); this.context.refresh(); EndpointHandlerMapping mapping = this.context.getBean("endpointHandlerMapping", EndpointHandlerMapping.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java index f4d830640f..9cfdaa2110 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java @@ -92,8 +92,8 @@ public class HealthIndicatorAutoConfigurationTests { public void defaultHealthIndicator() { this.context.register(HealthIndicatorAutoConfiguration.class, ManagementServerProperties.class); - TestPropertyValues.of( - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -106,8 +106,8 @@ public class HealthIndicatorAutoConfigurationTests { public void defaultHealthIndicatorsDisabled() { this.context.register(HealthIndicatorAutoConfiguration.class, ManagementServerProperties.class); - TestPropertyValues.of( - "management.health.defaults.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.defaults.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -120,8 +120,8 @@ public class HealthIndicatorAutoConfigurationTests { public void defaultHealthIndicatorsDisabledWithCustomOne() { this.context.register(CustomHealthIndicator.class, HealthIndicatorAutoConfiguration.class, ManagementServerProperties.class); - TestPropertyValues.of( - "management.health.defaults.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.defaults.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -134,8 +134,7 @@ public class HealthIndicatorAutoConfigurationTests { public void defaultHealthIndicatorsDisabledButOne() { this.context.register(HealthIndicatorAutoConfiguration.class, ManagementServerProperties.class); - TestPropertyValues.of( - "management.health.defaults.enabled:false", + TestPropertyValues.of("management.health.defaults.enabled:false", "management.health.diskspace.enabled:true").applyTo(this.context); this.context.refresh(); Map beans = this.context @@ -149,8 +148,8 @@ public class HealthIndicatorAutoConfigurationTests { public void redisHealthIndicator() { this.context.register(RedisAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); - TestPropertyValues.of( - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -163,9 +162,10 @@ public class HealthIndicatorAutoConfigurationTests { public void notRedisHealthIndicator() { this.context.register(RedisAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); - TestPropertyValues.of( - "management.health.redis.enabled:false", - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues + .of("management.health.redis.enabled:false", + "management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -179,8 +179,8 @@ public class HealthIndicatorAutoConfigurationTests { this.context.register(MongoAutoConfiguration.class, ManagementServerProperties.class, MongoDataAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); - TestPropertyValues.of( - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -194,9 +194,10 @@ public class HealthIndicatorAutoConfigurationTests { this.context.register(MongoAutoConfiguration.class, ManagementServerProperties.class, MongoDataAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); - TestPropertyValues.of( - "management.health.mongo.enabled:false", - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues + .of("management.health.mongo.enabled:false", + "management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -220,8 +221,8 @@ public class HealthIndicatorAutoConfigurationTests { public void dataSourceHealthIndicator() { this.context.register(EmbeddedDataSourceConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); - TestPropertyValues.of( - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -235,8 +236,8 @@ public class HealthIndicatorAutoConfigurationTests { this.context.register(EmbeddedDataSourceConfiguration.class, DataSourceConfig.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); - TestPropertyValues.of( - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -252,8 +253,8 @@ public class HealthIndicatorAutoConfigurationTests { this.context.register(EmbeddedDataSourceConfiguration.class, RoutingDatasourceConfig.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); - TestPropertyValues.of( - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -269,9 +270,10 @@ public class HealthIndicatorAutoConfigurationTests { DataSourceConfig.class, DataSourcePoolMetadataProvidersConfiguration.class, HealthIndicatorAutoConfiguration.class); - TestPropertyValues.of( - "spring.datasource.test.validation-query:SELECT from FOOBAR", - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues + .of("spring.datasource.test.validation-query:SELECT from FOOBAR", + "management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -286,9 +288,10 @@ public class HealthIndicatorAutoConfigurationTests { public void notDataSourceHealthIndicator() { this.context.register(EmbeddedDataSourceConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); - TestPropertyValues.of( - "management.health.db.enabled:false", - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues + .of("management.health.db.enabled:false", + "management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -301,8 +304,8 @@ public class HealthIndicatorAutoConfigurationTests { public void rabbitHealthIndicator() { this.context.register(RabbitAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); - TestPropertyValues.of( - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -315,9 +318,10 @@ public class HealthIndicatorAutoConfigurationTests { public void notRabbitHealthIndicator() { this.context.register(RabbitAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); - TestPropertyValues.of( - "management.health.rabbit.enabled:false", - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues + .of("management.health.rabbit.enabled:false", + "management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -330,8 +334,8 @@ public class HealthIndicatorAutoConfigurationTests { public void solrHealthIndicator() { this.context.register(SolrAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); - TestPropertyValues.of( - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -344,9 +348,10 @@ public class HealthIndicatorAutoConfigurationTests { public void notSolrHealthIndicator() { this.context.register(SolrAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); - TestPropertyValues.of( - "management.health.solr.enabled:false", - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues + .of("management.health.solr.enabled:false", + "management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -368,9 +373,10 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void mailHealthIndicator() { - TestPropertyValues.of( - "spring.mail.host:smtp.acme.org", - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues + .of("spring.mail.host:smtp.acme.org", + "management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.register(MailSenderAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); this.context.refresh(); @@ -384,9 +390,11 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void notMailHealthIndicator() { - TestPropertyValues.of( - "spring.mail.host:smtp.acme.org", "management.health.mail.enabled:false", - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues + .of("spring.mail.host:smtp.acme.org", + "management.health.mail.enabled:false", + "management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.register(MailSenderAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); this.context.refresh(); @@ -400,8 +408,8 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void jmsHealthIndicator() { - TestPropertyValues.of( - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.register(ActiveMQAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); this.context.refresh(); @@ -415,9 +423,10 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void notJmsHealthIndicator() { - TestPropertyValues.of( - "management.health.jms.enabled:false", - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues + .of("management.health.jms.enabled:false", + "management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.register(ActiveMQAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); this.context.refresh(); @@ -431,9 +440,10 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void elasticsearchHealthIndicator() { - TestPropertyValues.of( - "spring.data.elasticsearch.properties.path.home:target", - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues + .of("spring.data.elasticsearch.properties.path.home:target", + "management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.register(JestClientConfiguration.class, JestAutoConfiguration.class, ElasticsearchAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); @@ -448,8 +458,8 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void elasticsearchJestHealthIndicator() { - TestPropertyValues.of( - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.register(JestClientConfiguration.class, JestAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); this.context.refresh(); @@ -463,10 +473,11 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void notElasticsearchHealthIndicator() { - TestPropertyValues.of( - "management.health.elasticsearch.enabled:false", - "spring.data.elasticsearch.properties.path.home:target", - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues + .of("management.health.elasticsearch.enabled:false", + "spring.data.elasticsearch.properties.path.home:target", + "management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.register(JestClientConfiguration.class, JestAutoConfiguration.class, ElasticsearchAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); @@ -481,8 +492,8 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void cassandraHealthIndicator() throws Exception { - TestPropertyValues.of( - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.register(CassandraConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); this.context.refresh(); @@ -495,9 +506,10 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void notCassandraHealthIndicator() throws Exception { - TestPropertyValues.of( - "management.health.diskspace.enabled:false", - "management.health.cassandra.enabled:false").applyTo(this.context); + TestPropertyValues + .of("management.health.diskspace.enabled:false", + "management.health.cassandra.enabled:false") + .applyTo(this.context); this.context.register(CassandraConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); this.context.refresh(); @@ -510,8 +522,8 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void couchbaseHealthIndicator() throws Exception { - TestPropertyValues.of( - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.register(CouchbaseConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); this.context.refresh(); @@ -524,9 +536,10 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void notCouchbaseHealthIndicator() throws Exception { - TestPropertyValues.of( - "management.health.diskspace.enabled:false", - "management.health.couchbase.enabled:false").applyTo(this.context); + TestPropertyValues + .of("management.health.diskspace.enabled:false", + "management.health.couchbase.enabled:false") + .applyTo(this.context); this.context.register(CouchbaseConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); this.context.refresh(); @@ -539,8 +552,8 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void ldapHealthIndicator() throws Exception { - TestPropertyValues.of( - "management.health.diskspace.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.health.diskspace.enabled:false") + .applyTo(this.context); this.context.register(LdapConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); this.context.refresh(); @@ -553,8 +566,7 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void notLdapHealthIndicator() throws Exception { - TestPropertyValues.of( - "management.health.diskspace.enabled:false", + TestPropertyValues.of("management.health.diskspace.enabled:false", "management.health.ldap.enabled:false").applyTo(this.context); this.context.register(LdapConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointAutoConfigurationTests.java index 45dccae6cf..23f88a3222 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointAutoConfigurationTests.java @@ -80,8 +80,7 @@ public class HealthMvcEndpointAutoConfigurationTests { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(TestConfiguration.class); - TestPropertyValues.of( - "management.security.enabled=false").applyTo(this.context); + TestPropertyValues.of("management.security.enabled=false").applyTo(this.context); this.context.refresh(); Health health = (Health) this.context.getBean(HealthMvcEndpoint.class) .invoke(null, null); @@ -96,8 +95,7 @@ public class HealthMvcEndpointAutoConfigurationTests { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(TestConfiguration.class); - TestPropertyValues.of( - "management.security.roles[0]=super").applyTo(this.context); + TestPropertyValues.of("management.security.roles[0]=super").applyTo(this.context); this.context.refresh(); HealthMvcEndpoint health = this.context.getBean(HealthMvcEndpoint.class); assertThat(ReflectionTestUtils.getField(health, "roles")) diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfigurationTests.java index 456addc36e..264cd79f0f 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfigurationTests.java @@ -68,8 +68,9 @@ public class JolokiaAutoConfigurationTests { @Test public void agentServletRegisteredWithAppContext() throws Exception { this.context = new AnnotationConfigServletWebServerApplicationContext(); - TestPropertyValues.of("jolokia.config[key1]:value1", - "jolokia.config[key2]:value2").applyTo(this.context); + TestPropertyValues + .of("jolokia.config[key1]:value1", "jolokia.config[key2]:value2") + .applyTo(this.context); this.context.register(Config.class, WebMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, @@ -81,8 +82,7 @@ public class JolokiaAutoConfigurationTests { @Test public void agentServletWithCustomPath() throws Exception { this.context = new AnnotationConfigServletWebServerApplicationContext(); - TestPropertyValues.of( - "endpoints.jolokia.path=/foo/bar").applyTo(this.context); + TestPropertyValues.of("endpoints.jolokia.path=/foo/bar").applyTo(this.context); this.context.register(EndpointsConfig.class, WebMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java index b0e61b7f5c..65646e782c 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java @@ -100,7 +100,8 @@ public class ManagementWebSecurityAutoConfigurationTests { assertThat(filterChainProxy.getFilters("/application/beans")).isNotEmpty(); assertThat(filterChainProxy.getFilters("/application/beans/")).isNotEmpty(); assertThat(filterChainProxy.getFilters("/application/beans.foo")).isNotEmpty(); - assertThat(filterChainProxy.getFilters("/application/beans/foo/bar")).isNotEmpty(); + assertThat(filterChainProxy.getFilters("/application/beans/foo/bar")) + .isNotEmpty(); } @Test diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfigurationTests.java index e38f2022f1..ac29bd75e3 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfigurationTests.java @@ -148,8 +148,8 @@ public class MetricExportAutoConfigurationTests { @Test public void statsdWithHost() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.metrics.export.statsd.host=localhost").applyTo(this.context); + TestPropertyValues.of("spring.metrics.export.statsd.host=localhost") + .applyTo(this.context); this.context.register(MetricEndpointConfiguration.class, MetricExportAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java index 099c485beb..4b6ce78750 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java @@ -234,8 +234,7 @@ public class MetricFilterAutoConfigurationTests { @Test public void skipsFilterIfPropertyDisabled() throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "endpoints.metrics.filter.enabled:false").applyTo(context); + TestPropertyValues.of("endpoints.metrics.filter.enabled:false").applyTo(context); context.register(Config.class, MetricFilterAutoConfiguration.class); context.refresh(); assertThat(context.getBeansOfType(Filter.class).size()).isEqualTo(0); @@ -355,9 +354,10 @@ public class MetricFilterAutoConfigurationTests { throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(Config.class, MetricFilterAutoConfiguration.class); - TestPropertyValues.of( - "endpoints.metrics.filter.gauge-submissions=merged,per-http-method", - "endpoints.metrics.filter.counter-submissions=merged,per-http-method").applyTo(context); + TestPropertyValues + .of("endpoints.metrics.filter.gauge-submissions=merged,per-http-method", + "endpoints.metrics.filter.counter-submissions=merged,per-http-method") + .applyTo(context); context.refresh(); Filter filter = context.getBean(Filter.class); final MockHttpServletRequest request = new MockHttpServletRequest("PUT", @@ -387,8 +387,7 @@ public class MetricFilterAutoConfigurationTests { public void doesNotRecordRolledUpMetricsIfConfigured() throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(Config.class, MetricFilterAutoConfiguration.class); - TestPropertyValues.of( - "endpoints.metrics.filter.gauge-submissions=", + TestPropertyValues.of("endpoints.metrics.filter.gauge-submissions=", "endpoints.metrics.filter.counter-submissions=").applyTo(context); context.refresh(); Filter filter = context.getBean(Filter.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MvcEndpointPathConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MvcEndpointPathConfigurationTests.java index 876d69f535..143f901abd 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MvcEndpointPathConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MvcEndpointPathConfigurationTests.java @@ -117,10 +117,11 @@ public class MvcEndpointPathConfigurationTests { this.context = new AnnotationConfigWebApplicationContext(); this.context.register(TestConfiguration.class); this.context.setServletContext(new MockServletContext()); - TestPropertyValues.of( - "endpoints." + this.endpointName + ".path" + ":/custom/path", - "endpoints." + this.endpointName + ".enabled:true", - "logging.file:target/test.log").applyTo(this.context); + TestPropertyValues + .of("endpoints." + this.endpointName + ".path" + ":/custom/path", + "endpoints." + this.endpointName + ".enabled:true", + "logging.file:target/test.log") + .applyTo(this.context); this.context.refresh(); assertThat(getConfiguredPath()).isEqualTo("/custom/path"); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryActuatorAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryActuatorAutoConfigurationTests.java index b4c4e02611..41fde44070 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryActuatorAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryActuatorAutoConfigurationTests.java @@ -119,8 +119,8 @@ public class CloudFoundryActuatorAutoConfigurationTests { @Test public void skipSslValidation() throws Exception { - TestPropertyValues.of( - "management.cloudfoundry.skipSslValidation:true").applyTo(this.context); + TestPropertyValues.of("management.cloudfoundry.skipSslValidation:true") + .applyTo(this.context); ConfigurationPropertySources.attach(this.context.getEnvironment()); this.context.refresh(); CloudFoundryEndpointHandlerMapping handlerMapping = getHandlerMapping(); @@ -137,8 +137,9 @@ public class CloudFoundryActuatorAutoConfigurationTests { @Test public void cloudFoundryPlatformActiveAndCloudControllerUrlNotPresent() throws Exception { - TestPropertyValues.of("VCAP_APPLICATION:---", - "vcap.application.application_id:my-app-id").applyTo(this.context); + TestPropertyValues + .of("VCAP_APPLICATION:---", "vcap.application.application_id:my-app-id") + .applyTo(this.context); this.context.refresh(); CloudFoundryEndpointHandlerMapping handlerMapping = this.context.getBean( "cloudFoundryEndpointHandlerMapping", @@ -152,8 +153,9 @@ public class CloudFoundryActuatorAutoConfigurationTests { @Test public void cloudFoundryPathsIgnoredBySpringSecurity() throws Exception { - TestPropertyValues.of("VCAP_APPLICATION:---", - "vcap.application.application_id:my-app-id").applyTo(this.context); + TestPropertyValues + .of("VCAP_APPLICATION:---", "vcap.application.application_id:my-app-id") + .applyTo(this.context); this.context.refresh(); IgnoredRequestCustomizer customizer = (IgnoredRequestCustomizer) this.context .getBean("cloudFoundryIgnoredRequestCustomizer"); @@ -179,17 +181,19 @@ public class CloudFoundryActuatorAutoConfigurationTests { @Test public void cloudFoundryManagementEndpointsDisabled() throws Exception { - TestPropertyValues.of("VCAP_APPLICATION=---", - "management.cloudfoundry.enabled:false").applyTo(this.context); + TestPropertyValues + .of("VCAP_APPLICATION=---", "management.cloudfoundry.enabled:false") + .applyTo(this.context); this.context.refresh(); assertThat(this.context.containsBean("cloudFoundryEndpointHandlerMapping")) .isFalse(); } private CloudFoundryEndpointHandlerMapping getHandlerMapping() { - TestPropertyValues.of("VCAP_APPLICATION:---", - "vcap.application.application_id:my-app-id", - "vcap.application.cf_api:http://my-cloud-controller.com").applyTo(this.context); + TestPropertyValues + .of("VCAP_APPLICATION:---", "vcap.application.application_id:my-app-id", + "vcap.application.cf_api:http://my-cloud-controller.com") + .applyTo(this.context); this.context.refresh(); return this.context.getBean("cloudFoundryEndpointHandlerMapping", CloudFoundryEndpointHandlerMapping.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointMethodAnnotationsTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointMethodAnnotationsTests.java index 5f810016ec..5a8ca1f54b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointMethodAnnotationsTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointMethodAnnotationsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,8 +56,7 @@ public class ConfigurationPropertiesReportEndpointMethodAnnotationsTests { @SuppressWarnings("unchecked") public void testNaming() throws Exception { this.context.register(Config.class); - TestPropertyValues.of("other.name:foo", - "first.name:bar").applyTo(this.context); + TestPropertyValues.of("other.name:foo", "first.name:bar").applyTo(this.context); this.context.refresh(); ConfigurationPropertiesReportEndpoint report = this.context .getBean(ConfigurationPropertiesReportEndpoint.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointSerializationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointSerializationTests.java index bcab102ddd..b4a8bdae6a 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointSerializationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointSerializationTests.java @@ -203,8 +203,8 @@ public class ConfigurationPropertiesReportEndpointSerializationTests { @SuppressWarnings("unchecked") public void testInitializedMapAndList() throws Exception { this.context.register(InitializedMapAndListPropertiesConfig.class); - TestPropertyValues.of("foo.map.entryOne:true", - "foo.list[0]:abc").applyTo(this.context); + TestPropertyValues.of("foo.map.entryOne:true", "foo.list[0]:abc") + .applyTo(this.context); this.context.refresh(); ConfigurationPropertiesReportEndpoint report = this.context .getBean(ConfigurationPropertiesReportEndpoint.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java index 34b75a45e6..032ea2b881 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java @@ -130,8 +130,8 @@ public class ConfigurationPropertiesReportEndpointTests @Test public void testKeySanitizationWithCustomKeysByEnvironment() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "endpoints.configprops.keys-to-sanitize:property").applyTo(this.context); + TestPropertyValues.of("endpoints.configprops.keys-to-sanitize:property") + .applyTo(this.context); this.context.register(Config.class); this.context.refresh(); ConfigurationPropertiesReportEndpoint report = getEndpointBean(); @@ -147,8 +147,8 @@ public class ConfigurationPropertiesReportEndpointTests @Test public void testKeySanitizationWithCustomPatternByEnvironment() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "endpoints.configprops.keys-to-sanitize: .*pass.*").applyTo(this.context); + TestPropertyValues.of("endpoints.configprops.keys-to-sanitize: .*pass.*") + .applyTo(this.context); this.context.register(Config.class); this.context.refresh(); ConfigurationPropertiesReportEndpoint report = getEndpointBean(); @@ -165,8 +165,9 @@ public class ConfigurationPropertiesReportEndpointTests public void testKeySanitizationWithCustomPatternAndKeyByEnvironment() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "endpoints.configprops.keys-to-sanitize: .*pass.*, property").applyTo(this.context); + TestPropertyValues + .of("endpoints.configprops.keys-to-sanitize: .*pass.*, property") + .applyTo(this.context); this.context.register(Config.class); this.context.refresh(); ConfigurationPropertiesReportEndpoint report = getEndpointBean(); @@ -184,8 +185,9 @@ public class ConfigurationPropertiesReportEndpointTests throws Exception { // gh-4415 this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "endpoints.configprops.keys-to-sanitize: .*\\.secrets\\..*, .*\\.hidden\\..*").applyTo(this.context); + TestPropertyValues + .of("endpoints.configprops.keys-to-sanitize: .*\\.secrets\\..*, .*\\.hidden\\..*") + .applyTo(this.context); this.context.register(Config.class); this.context.refresh(); ConfigurationPropertiesReportEndpoint report = getEndpointBean(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java index 7d1a16b2fa..72ec5333fc 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java @@ -151,8 +151,8 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests(null, headers), String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND); - assertThat(entity.getHeaders().getLocation()).isEqualTo( - URI.create("http://localhost:" + this.port + "/application/browser.html")); + assertThat(entity.getHeaders().getLocation()).isEqualTo(URI + .create("http://localhost:" + this.port + "/application/browser.html")); } @MinimalActuatorHypermediaApplication diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointVanillaIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointVanillaIntegrationTests.java index e4e863554e..a9cb5ee87c 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointVanillaIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointVanillaIntegrationTests.java @@ -85,8 +85,9 @@ public class HalBrowserMvcEndpointVanillaIntegrationTests { @Test public void browser() throws Exception { this.mockMvc.perform(get("/application/").accept(MediaType.TEXT_HTML)) - .andExpect(status().isFound()).andExpect(header().string( - HttpHeaders.LOCATION, "http://localhost/application/browser.html")); + .andExpect(status().isFound()) + .andExpect(header().string(HttpHeaders.LOCATION, + "http://localhost/application/browser.html")); } @Test @@ -98,7 +99,9 @@ public class HalBrowserMvcEndpointVanillaIntegrationTests { @Test public void envValue() throws Exception { - this.mockMvc.perform(get("/application/env/user.home").accept(MediaType.APPLICATION_JSON)) + this.mockMvc + .perform(get("/application/env/user.home") + .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$._links").doesNotExist()); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalJsonMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalJsonMvcEndpointTests.java index 5cd454b1f2..a5a5f8d247 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalJsonMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalJsonMvcEndpointTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.actuate.endpoint.mvc; - import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -43,14 +42,17 @@ public class HalJsonMvcEndpointTests { @Test public void halJsonEndpointPathWhenManagementContextPathPresent() throws Exception { Mockito.when(this.managementServletContext.getContextPath()).thenReturn("my-app"); - HalJsonMvcEndpoint endpoint = new HalJsonMvcEndpoint(this.managementServletContext); + HalJsonMvcEndpoint endpoint = new HalJsonMvcEndpoint( + this.managementServletContext); assertThat(endpoint.getPath()).isEqualTo(""); } @Test - public void halJsonEndpointPathWhenManagementContextPathNotPresent() throws Exception { + public void halJsonEndpointPathWhenManagementContextPathNotPresent() + throws Exception { Mockito.when(this.managementServletContext.getContextPath()).thenReturn(""); - HalJsonMvcEndpoint endpoint = new HalJsonMvcEndpoint(this.managementServletContext); + HalJsonMvcEndpoint endpoint = new HalJsonMvcEndpoint( + this.managementServletContext); assertThat(endpoint.getPath()).isEqualTo("/application"); } } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpointTests.java index 1be0ac258f..3f20a25220 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpointTests.java @@ -89,20 +89,22 @@ public class HeapdumpMvcEndpointTests { public void invokeWhenNotAvailableShouldReturnServiceUnavailableStatus() throws Exception { this.endpoint.setAvailable(false); - this.mvc.perform(get("/application/heapdump")).andExpect(status().isServiceUnavailable()); + this.mvc.perform(get("/application/heapdump")) + .andExpect(status().isServiceUnavailable()); } @Test public void invokeWhenLockedShouldReturnTooManyRequestsStatus() throws Exception { this.endpoint.setLocked(true); - this.mvc.perform(get("/application/heapdump")).andExpect(status().isTooManyRequests()); + this.mvc.perform(get("/application/heapdump")) + .andExpect(status().isTooManyRequests()); assertThat(Thread.interrupted()).isTrue(); } @Test public void invokeShouldReturnGzipContent() throws Exception { - MvcResult result = this.mvc.perform(get("/application/heapdump")).andExpect(status().isOk()) - .andReturn(); + MvcResult result = this.mvc.perform(get("/application/heapdump")) + .andExpect(status().isOk()).andReturn(); byte[] bytes = result.getResponse().getContentAsByteArray(); GZIPInputStream stream = new GZIPInputStream(new ByteArrayInputStream(bytes)); byte[] uncompressed = FileCopyUtils.copyToByteArray(stream); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointTests.java index 73910b4289..d23a817d39 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointTests.java @@ -91,9 +91,9 @@ public class InfoMvcEndpointTests { @Test public void contentTypeCanBeApplicationJson() throws Exception { - this.mvc.perform( - get("/application/info").header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().isOk()).andExpect(header().string("Content-Type", + this.mvc.perform(get("/application/info").header(HttpHeaders.ACCEPT, + MediaType.APPLICATION_JSON_VALUE)).andExpect(status().isOk()) + .andExpect(header().string("Content-Type", MediaType.APPLICATION_JSON_UTF8_VALUE)); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java index a28181ad54..28af3f34d6 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java @@ -71,7 +71,8 @@ public class JolokiaMvcEndpointContextPathTests { @Before public void setUp() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build(); - TestPropertyValues.of("foo:bar").applyTo((ConfigurableApplicationContext) this.context); + TestPropertyValues.of("foo:bar") + .applyTo((ConfigurableApplicationContext) this.context); } @Test diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointIntegrationTests.java index d20a1b7e0e..4ba57a9a23 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointIntegrationTests.java @@ -67,7 +67,8 @@ public class JolokiaMvcEndpointIntegrationTests { @Before public void setUp() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build(); - TestPropertyValues.of("foo:bar").applyTo((ConfigurableApplicationContext) this.context); + TestPropertyValues.of("foo:bar") + .applyTo((ConfigurableApplicationContext) this.context); } @Test @@ -78,7 +79,8 @@ public class JolokiaMvcEndpointIntegrationTests { @Test public void search() throws Exception { - this.mvc.perform(get("/application/jolokia/search/java.lang:*")).andExpect(status().isOk()) + this.mvc.perform(get("/application/jolokia/search/java.lang:*")) + .andExpect(status().isOk()) .andExpect(content().string(containsString("GarbageCollector"))); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointCorsIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointCorsIntegrationTests.java index 315013517a..e5a13934ed 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointCorsIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointCorsIntegrationTests.java @@ -70,8 +70,8 @@ public class MvcEndpointCorsIntegrationTests { @Test public void settingAllowedOriginsEnablesCors() throws Exception { - TestPropertyValues.of( - "endpoints.cors.allowed-origins:foo.example.com").applyTo(this.context); + TestPropertyValues.of("endpoints.cors.allowed-origins:foo.example.com") + .applyTo(this.context); createMockMvc() .perform(options("/application/beans").header("Origin", "bar.example.com") .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")) @@ -81,16 +81,15 @@ public class MvcEndpointCorsIntegrationTests { @Test public void maxAgeDefaultsTo30Minutes() throws Exception { - TestPropertyValues.of( - "endpoints.cors.allowed-origins:foo.example.com").applyTo(this.context); + TestPropertyValues.of("endpoints.cors.allowed-origins:foo.example.com") + .applyTo(this.context); performAcceptedCorsRequest() .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800")); } @Test public void maxAgeCanBeConfigured() throws Exception { - TestPropertyValues.of( - "endpoints.cors.allowed-origins:foo.example.com", + TestPropertyValues.of("endpoints.cors.allowed-origins:foo.example.com", "endpoints.cors.max-age: 2400").applyTo(this.context); performAcceptedCorsRequest() .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "2400")); @@ -98,8 +97,8 @@ public class MvcEndpointCorsIntegrationTests { @Test public void requestsWithDisallowedHeadersAreRejected() throws Exception { - TestPropertyValues.of( - "endpoints.cors.allowed-origins:foo.example.com").applyTo(this.context); + TestPropertyValues.of("endpoints.cors.allowed-origins:foo.example.com") + .applyTo(this.context); createMockMvc() .perform(options("/application/beans").header("Origin", "foo.example.com") .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET") @@ -109,9 +108,10 @@ public class MvcEndpointCorsIntegrationTests { @Test public void allowedHeadersCanBeConfigured() throws Exception { - TestPropertyValues.of( - "endpoints.cors.allowed-origins:foo.example.com", - "endpoints.cors.allowed-headers:Alpha,Bravo").applyTo(this.context); + TestPropertyValues + .of("endpoints.cors.allowed-origins:foo.example.com", + "endpoints.cors.allowed-headers:Alpha,Bravo") + .applyTo(this.context); createMockMvc() .perform(options("/application/beans").header("Origin", "foo.example.com") .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET") @@ -122,21 +122,22 @@ public class MvcEndpointCorsIntegrationTests { @Test public void requestsWithDisallowedMethodsAreRejected() throws Exception { - TestPropertyValues.of( - "endpoints.cors.allowed-origins:foo.example.com").applyTo(this.context); + TestPropertyValues.of("endpoints.cors.allowed-origins:foo.example.com") + .applyTo(this.context); createMockMvc() - .perform(options("/application/health").header(HttpHeaders.ORIGIN, "foo.example.com") + .perform(options("/application/health") + .header(HttpHeaders.ORIGIN, "foo.example.com") .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "PATCH")) .andExpect(status().isForbidden()); } @Test public void allowedMethodsCanBeConfigured() throws Exception { - TestPropertyValues.of( - "endpoints.cors.allowed-origins:foo.example.com", + TestPropertyValues.of("endpoints.cors.allowed-origins:foo.example.com", "endpoints.cors.allowed-methods:GET,HEAD").applyTo(this.context); createMockMvc() - .perform(options("/application/health").header(HttpHeaders.ORIGIN, "foo.example.com") + .perform(options("/application/health") + .header(HttpHeaders.ORIGIN, "foo.example.com") .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "HEAD")) .andExpect(status().isOk()).andExpect(header() .string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,HEAD")); @@ -144,8 +145,7 @@ public class MvcEndpointCorsIntegrationTests { @Test public void credentialsCanBeAllowed() throws Exception { - TestPropertyValues.of( - "endpoints.cors.allowed-origins:foo.example.com", + TestPropertyValues.of("endpoints.cors.allowed-origins:foo.example.com", "endpoints.cors.allow-credentials:true").applyTo(this.context); performAcceptedCorsRequest().andExpect( header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true")); @@ -153,8 +153,7 @@ public class MvcEndpointCorsIntegrationTests { @Test public void credentialsCanBeDisabled() throws Exception { - TestPropertyValues.of( - "endpoints.cors.allowed-origins:foo.example.com", + TestPropertyValues.of("endpoints.cors.allowed-origins:foo.example.com", "endpoints.cors.allow-credentials:false").applyTo(this.context); performAcceptedCorsRequest().andExpect( header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS)); @@ -162,10 +161,11 @@ public class MvcEndpointCorsIntegrationTests { @Test public void jolokiaEndpointUsesGlobalCorsConfiguration() throws Exception { - TestPropertyValues.of( - "endpoints.cors.allowed-origins:foo.example.com").applyTo(this.context); + TestPropertyValues.of("endpoints.cors.allowed-origins:foo.example.com") + .applyTo(this.context); createMockMvc() - .perform(options("/application/jolokia").header("Origin", "bar.example.com") + .perform(options("/application/jolokia") + .header("Origin", "bar.example.com") .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")) .andExpect(status().isForbidden()); performAcceptedCorsRequest("/application/jolokia"); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointIntegrationTests.java index 496d5eca21..45c8bb2a12 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointIntegrationTests.java @@ -72,7 +72,8 @@ public class MvcEndpointIntegrationTests { this.context = new AnnotationConfigWebApplicationContext(); this.context.register(SecureConfiguration.class); MockMvc mockMvc = createSecureMockMvc(); - mockMvc.perform(get("/application/mappings")).andExpect(content().string(startsWith("{\""))); + mockMvc.perform(get("/application/mappings")) + .andExpect(content().string(startsWith("{\""))); } @Test @@ -124,8 +125,8 @@ public class MvcEndpointIntegrationTests { throws Exception { this.context = new AnnotationConfigWebApplicationContext(); this.context.register(SecureConfiguration.class); - TestPropertyValues.of( - "management.context-path:/management").applyTo(this.context); + TestPropertyValues.of("management.context-path:/management") + .applyTo(this.context); MockMvc mockMvc = createSecureMockMvc(); mockMvc.perform(get("/management/info")).andExpect(status().isOk()); mockMvc.perform(get("/management")).andExpect(status().isOk()); @@ -144,8 +145,8 @@ public class MvcEndpointIntegrationTests { throws Exception { this.context = new AnnotationConfigWebApplicationContext(); this.context.register(SecureConfiguration.class); - TestPropertyValues.of( - "management.context-path:/management").applyTo(this.context); + TestPropertyValues.of("management.context-path:/management") + .applyTo(this.context); MockMvc mockMvc = createSecureMockMvc(); mockMvc.perform(get("/management/beans")).andExpect(status().isUnauthorized()); } @@ -157,8 +158,8 @@ public class MvcEndpointIntegrationTests { new TestingAuthenticationToken("user", "N/A", "ROLE_USER")); this.context = new AnnotationConfigWebApplicationContext(); this.context.register(SecureConfiguration.class); - TestPropertyValues.of( - "management.context-path:/management").applyTo(this.context); + TestPropertyValues.of("management.context-path:/management") + .applyTo(this.context); MockMvc mockMvc = createSecureMockMvc(); mockMvc.perform(get("/management/beans")).andExpect(status().isForbidden()); } @@ -170,8 +171,8 @@ public class MvcEndpointIntegrationTests { new TestingAuthenticationToken("user", "N/A", "ROLE_ACTUATOR")); this.context = new AnnotationConfigWebApplicationContext(); this.context.register(SecureConfiguration.class); - TestPropertyValues.of( - "management.context-path:/management").applyTo(this.context); + TestPropertyValues.of("management.context-path:/management") + .applyTo(this.context); MockMvc mockMvc = createSecureMockMvc(); mockMvc.perform(get("/management/beans")).andExpect(status().isOk()); } @@ -180,8 +181,7 @@ public class MvcEndpointIntegrationTests { public void endpointSecurityCanBeDisabledWithCustomContextPath() throws Exception { this.context = new AnnotationConfigWebApplicationContext(); this.context.register(SecureConfiguration.class); - TestPropertyValues.of( - "management.context-path:/management", + TestPropertyValues.of("management.context-path:/management", "management.security.enabled:false").applyTo(this.context); MockMvc mockMvc = createSecureMockMvc(); mockMvc.perform(get("/management/beans")).andExpect(status().isOk()); @@ -191,8 +191,7 @@ public class MvcEndpointIntegrationTests { public void endpointSecurityCanBeDisabled() throws Exception { this.context = new AnnotationConfigWebApplicationContext(); this.context.register(SecureConfiguration.class); - TestPropertyValues.of( - "management.security.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.security.enabled:false").applyTo(this.context); MockMvc mockMvc = createSecureMockMvc(); mockMvc.perform(get("/application/beans")).andExpect(status().isOk()); } @@ -202,8 +201,8 @@ public class MvcEndpointIntegrationTests { new TestingAuthenticationToken("user", "N/A", "ROLE_ACTUATOR")); this.context = new AnnotationConfigWebApplicationContext(); this.context.register(configuration); - TestPropertyValues.of( - "spring.jackson.serialization.indent-output:true").applyTo(this.context); + TestPropertyValues.of("spring.jackson.serialization.indent-output:true") + .applyTo(this.context); MockMvc mockMvc = createSecureMockMvc(); mockMvc.perform(get("/application/mappings")) .andExpect(content().string(startsWith("{" + LINE_SEPARATOR))); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointsTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointsTests.java index dafb4b0a35..3e3b6a984f 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointsTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,8 +68,7 @@ public class MvcEndpointsTests { @Test public void changesPath() throws Exception { - TestPropertyValues.of( - "endpoints.test.path=/foo/bar/").applyTo(this.context); + TestPropertyValues.of("endpoints.test.path=/foo/bar/").applyTo(this.context); this.context.getDefaultListableBeanFactory().registerSingleton("endpoint", new TestEndpoint()); this.endpoints.setApplicationContext(this.context); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/NoSpringSecurityHealthMvcEndpointIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/NoSpringSecurityHealthMvcEndpointIntegrationTests.java index d117b203e4..6b60f4cfbc 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/NoSpringSecurityHealthMvcEndpointIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/NoSpringSecurityHealthMvcEndpointIntegrationTests.java @@ -84,8 +84,7 @@ public class NoSpringSecurityHealthMvcEndpointIntegrationTests { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(TestConfiguration.class); - TestPropertyValues.of( - "management.security.enabled:false").applyTo(this.context); + TestPropertyValues.of("management.security.enabled:false").applyTo(this.context); this.context.refresh(); MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(this.context).build(); mockMvc.perform(get("/application/health")).andExpect(status().isOk()) diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/EnvironmentInfoContributorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/EnvironmentInfoContributorTests.java index b44123d5e2..e92e5b0511 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/EnvironmentInfoContributorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/EnvironmentInfoContributorTests.java @@ -38,8 +38,8 @@ public class EnvironmentInfoContributorTests { @Test public void extractOnlyInfoProperty() { - TestPropertyValues.of("info.app=my app", - "info.version=1.0.0", "foo=bar").applyTo(this.environment); + TestPropertyValues.of("info.app=my app", "info.version=1.0.0", "foo=bar") + .applyTo(this.environment); Info actual = contributeFrom(this.environment); assertThat(actual.get("app", String.class)).isEqualTo("my app"); assertThat(actual.get("version", String.class)).isEqualTo("1.0.0"); @@ -56,7 +56,8 @@ public class EnvironmentInfoContributorTests { @Test @SuppressWarnings("unchecked") public void propertiesFromEnvironmentShouldBindCorrectly() throws Exception { - TestPropertyValues.of("INFO_ENVIRONMENT_FOO=green").applyTo(this.environment, Type.SYSTEM); + TestPropertyValues.of("INFO_ENVIRONMENT_FOO=green").applyTo(this.environment, + Type.SYSTEM); Info actual = contributeFrom(this.environment); assertThat(actual.get("environment", Map.class)).containsEntry("foo", "green"); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricCopyExporterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricCopyExporterTests.java index e02485950c..40b61f6bbe 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricCopyExporterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricCopyExporterTests.java @@ -62,7 +62,8 @@ public class MetricCopyExporterTests { @Test public void counterWithGaugeWriter() throws Exception { SimpleGaugeWriter writer = new SimpleGaugeWriter(); - try (MetricCopyExporter customExporter = new MetricCopyExporter(this.reader, writer)) { + try (MetricCopyExporter customExporter = new MetricCopyExporter(this.reader, + writer)) { this.reader.increment(new Delta("counter.foo", 2)); customExporter.export(); this.reader.increment(new Delta("counter.foo", 3)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchConfigurerConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchConfigurerConfiguration.java index 68f47525c4..d21d65372c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchConfigurerConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchConfigurerConfiguration.java @@ -30,7 +30,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.transaction.PlatformTransactionManager; /** - * Provide a {@link BatchConfigurer} according to the current environment. + * Provide a {@link BatchConfigurer} according to the current environment. * * @author Stephane Nicoll */ @@ -68,4 +68,3 @@ class BatchConfigurerConfiguration { } } - diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfiguration.java index c5cc5d6170..dd161f0ec0 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfiguration.java @@ -101,8 +101,7 @@ public class JooqAutoConfiguration { private final VisitListenerProvider[] visitListenerProviders; public DslContextConfiguration(JooqProperties properties, - ConnectionProvider connectionProvider, - DataSource dataSource, + ConnectionProvider connectionProvider, DataSource dataSource, ObjectProvider transactionProvider, ObjectProvider recordMapperProvider, ObjectProvider settings, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfiguration.java index 284db53cf8..1753e04761 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfiguration.java @@ -77,8 +77,7 @@ public class QuartzAutoConfiguration { ObjectProvider> customizers, ObjectProvider taskExecutor, ObjectProvider jobDetails, ObjectProvider> calendars, - ObjectProvider triggers, - ApplicationContext applicationContext) { + ObjectProvider triggers, ApplicationContext applicationContext) { this.properties = properties; this.customizers = customizers.getIfAvailable(); this.taskExecutor = taskExecutor.getIfAvailable(); @@ -147,8 +146,8 @@ public class QuartzAutoConfiguration { return schedulerFactoryBean -> { if (properties.getJobStoreType() == JobStoreType.JDBC) { schedulerFactoryBean.setDataSource(dataSource); - PlatformTransactionManager txManager = - transactionManager.getIfUnique(); + PlatformTransactionManager txManager = transactionManager + .getIfUnique(); if (txManager != null) { schedulerFactoryBean.setTransactionManager(txManager); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapter.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapter.java index c91ee83d10..93dc9534f4 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapter.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapter.java @@ -95,8 +95,9 @@ public class ValidatorAdapter implements SmartValidator, ApplicationContextAware /** * Return a {@link Validator} that only implements the {@link Validator} interface, * wrapping it if necessary. - *

If the specified {@link Validator} is not {@code null}, it is wrapped. If not, - * a {@link javax.validation.Validator} is retrieved from the context and wrapped. + *

+ * If the specified {@link Validator} is not {@code null}, it is wrapped. If not, a + * {@link javax.validation.Validator} is retrieved from the context and wrapped. * Otherwise, a new default validator is created. * @param applicationContext the application context * @param validator an existing validator to use or {@code null} diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/HttpHandlerAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/HttpHandlerAutoConfiguration.java index 9cdbc9f633..f5dec008d2 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/HttpHandlerAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/HttpHandlerAutoConfiguration.java @@ -56,7 +56,8 @@ public class HttpHandlerAutoConfiguration { @Bean public HttpHandler httpHandler() { - return WebHttpHandlerBuilder.applicationContext(this.applicationContext).build(); + return WebHttpHandlerBuilder.applicationContext(this.applicationContext) + .build(); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerAutoConfiguration.java index 83fe674cce..25558bcc32 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveWebServerAutoConfiguration.java @@ -51,7 +51,7 @@ import org.springframework.util.ObjectUtils; ReactiveWebServerConfiguration.TomcatAutoConfiguration.class, ReactiveWebServerConfiguration.JettyAutoConfiguration.class, ReactiveWebServerConfiguration.UndertowAutoConfiguration.class, - ReactiveWebServerConfiguration.ReactorNettyAutoConfiguration.class}) + ReactiveWebServerConfiguration.ReactorNettyAutoConfiguration.class }) public class ReactiveWebServerAutoConfiguration { @ConditionalOnMissingBean diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java index 0daed75ffd..d9342bbf4f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java @@ -132,7 +132,7 @@ public class BatchAutoConfigurationTests { @Test public void testDefinesAndLaunchesNamedJob() throws Exception { load(new Class[] { NamedJobConfigurationWithRegisteredJob.class, - EmbeddedDataSourceConfiguration.class }, + EmbeddedDataSourceConfiguration.class }, "spring.batch.job.names:discreteRegisteredJob"); JobRepository repository = this.context.getBean(JobRepository.class); assertThat(this.context.getBean(JobLauncher.class)).isNotNull(); @@ -144,19 +144,19 @@ public class BatchAutoConfigurationTests { @Test public void testDefinesAndLaunchesLocalJob() throws Exception { load(new Class[] { NamedJobConfigurationWithLocalJob.class, - EmbeddedDataSourceConfiguration.class }, + EmbeddedDataSourceConfiguration.class }, "spring.batch.job.names:discreteLocalJob"); assertThat(this.context.getBean(JobLauncher.class)).isNotNull(); this.context.getBean(JobLauncherCommandLineRunner.class).run(); assertThat(this.context.getBean(JobRepository.class) .getLastJobExecution("discreteLocalJob", new JobParameters())) - .isNotNull(); + .isNotNull(); } @Test public void testDisableLaunchesJob() throws Exception { load(new Class[] { JobConfiguration.class, - EmbeddedDataSourceConfiguration.class }, + EmbeddedDataSourceConfiguration.class }, "spring.batch.job.enabled:false"); assertThat(this.context.getBean(JobLauncher.class)).isNotNull(); assertThat(this.context.getBeanNamesForType(CommandLineRunner.class).length) @@ -166,13 +166,13 @@ public class BatchAutoConfigurationTests { @Test public void testDisableSchemaLoader() throws Exception { load(new Class[] { TestConfiguration.class, - EmbeddedDataSourceConfiguration.class }, + EmbeddedDataSourceConfiguration.class }, "spring.datasource.generate-unique-name=true", "spring.batch.initializer.enabled:false"); assertThat(this.context.getBean(JobLauncher.class)).isNotNull(); assertThat( this.context.getBean(BatchProperties.class).getInitializer().isEnabled()) - .isFalse(); + .isFalse(); this.expected.expect(BadSqlGrammarException.class); new JdbcTemplate(this.context.getBean(DataSource.class)) .queryForList("select * from BATCH_JOB_EXECUTION"); @@ -197,8 +197,8 @@ public class BatchAutoConfigurationTests { @Test public void testRenamePrefix() throws Exception { load(new Class[] { TestConfiguration.class, - EmbeddedDataSourceConfiguration.class, - HibernateJpaAutoConfiguration.class }, + EmbeddedDataSourceConfiguration.class, + HibernateJpaAutoConfiguration.class }, "spring.datasource.generate-unique-name=true", "spring.batch.schema:classpath:batch/custom-schema-hsql.sql", "spring.batch.tablePrefix:PREFIX_"); @@ -219,14 +219,14 @@ public class BatchAutoConfigurationTests { public void testCustomTablePrefixWithDefaultSchemaDisablesInitializer() throws Exception { load(new Class[] { TestConfiguration.class, - EmbeddedDataSourceConfiguration.class, - HibernateJpaAutoConfiguration.class }, + EmbeddedDataSourceConfiguration.class, + HibernateJpaAutoConfiguration.class }, "spring.datasource.generate-unique-name=true", "spring.batch.tablePrefix:PREFIX_"); assertThat(this.context.getBean(JobLauncher.class)).isNotNull(); assertThat( this.context.getBean(BatchProperties.class).getInitializer().isEnabled()) - .isFalse(); + .isFalse(); this.expected.expect(BadSqlGrammarException.class); new JdbcTemplate(this.context.getBean(DataSource.class)) .queryForList("select * from BATCH_JOB_EXECUTION"); @@ -235,8 +235,8 @@ public class BatchAutoConfigurationTests { @Test public void testCustomizeJpaTransactionManagerUsingProperties() throws Exception { load(new Class[] { TestConfiguration.class, - EmbeddedDataSourceConfiguration.class, - HibernateJpaAutoConfiguration.class }, + EmbeddedDataSourceConfiguration.class, + HibernateJpaAutoConfiguration.class }, "spring.transaction.default-timeout:30", "spring.transaction.rollback-on-commit-failure:true"); this.context.getBean(BatchConfigurer.class); @@ -250,7 +250,7 @@ public class BatchAutoConfigurationTests { public void testCustomizeDataSourceTransactionManagerUsingProperties() throws Exception { load(new Class[] { TestConfiguration.class, - EmbeddedDataSourceConfiguration.class }, + EmbeddedDataSourceConfiguration.class }, "spring.transaction.default-timeout:30", "spring.transaction.rollback-on-commit-failure:true"); this.context.getBean(BatchConfigurer.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationWithoutJpaTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationWithoutJpaTests.java index 676d3a829d..067353f5c3 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationWithoutJpaTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationWithoutJpaTests.java @@ -62,7 +62,7 @@ public class BatchAutoConfigurationWithoutJpaTests { @Test public void jdbcWithDefaultSettings() throws Exception { load(new Class[] { DefaultConfiguration.class, - EmbeddedDataSourceConfiguration.class }, + EmbeddedDataSourceConfiguration.class }, "spring.datasource.generate-unique-name=true"); assertThat(this.context.getBeansOfType(JobLauncher.class)).hasSize(1); assertThat(this.context.getBeansOfType(JobExplorer.class)).hasSize(1); @@ -73,28 +73,30 @@ public class BatchAutoConfigurationWithoutJpaTests { .contains("DataSourceTransactionManager"); assertThat( this.context.getBean(BatchProperties.class).getInitializer().isEnabled()) - .isTrue(); + .isTrue(); assertThat(new JdbcTemplate(this.context.getBean(DataSource.class)) .queryForList("select * from BATCH_JOB_EXECUTION")).isEmpty(); - assertThat(this.context.getBean(JobExplorer.class) - .findRunningJobExecutions("test")).isEmpty(); - assertThat(this.context.getBean(JobRepository.class) - .getLastJobExecution("test", new JobParameters())).isNull(); + assertThat( + this.context.getBean(JobExplorer.class).findRunningJobExecutions("test")) + .isEmpty(); + assertThat(this.context.getBean(JobRepository.class).getLastJobExecution("test", + new JobParameters())).isNull(); } @Test public void jdbcWithCustomPrefix() throws Exception { load(new Class[] { DefaultConfiguration.class, - EmbeddedDataSourceConfiguration.class }, + EmbeddedDataSourceConfiguration.class }, "spring.datasource.generate-unique-name=true", "spring.batch.schema:classpath:batch/custom-schema-hsql.sql", "spring.batch.tablePrefix:PREFIX_"); assertThat(new JdbcTemplate(this.context.getBean(DataSource.class)) .queryForList("select * from PREFIX_JOB_EXECUTION")).isEmpty(); - assertThat(this.context.getBean(JobExplorer.class) - .findRunningJobExecutions("test")).isEmpty(); - assertThat(this.context.getBean(JobRepository.class) - .getLastJobExecution("test", new JobParameters())).isNull(); + assertThat( + this.context.getBean(JobExplorer.class).findRunningJobExecutions("test")) + .isEmpty(); + assertThat(this.context.getBean(JobRepository.class).getLastJobExecution("test", + new JobParameters())).isNull(); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java index beaa29d353..a839f1745a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java @@ -147,8 +147,8 @@ public class MessageSourceAutoConfigurationTests { parent.refresh(); this.context = new AnnotationConfigApplicationContext(); this.context.setParent(parent); - TestPropertyValues.of( - "spring.messages.basename:test/messages").applyTo(this.context); + TestPropertyValues.of("spring.messages.basename:test/messages") + .applyTo(this.context); this.context.register(MessageSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfigurationTests.java index e2675831b2..2b87ea5645 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfigurationTests.java @@ -66,8 +66,8 @@ public class PersistenceExceptionTranslationAutoConfigurationTests { @Test public void exceptionTranslationPostProcessorCanBeConfiguredToUseJdkProxy() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.aop.proxy-target-class=false").applyTo(this.context); + TestPropertyValues.of("spring.aop.proxy-target-class=false") + .applyTo(this.context); this.context.register(PersistenceExceptionTranslationAutoConfiguration.class); this.context.refresh(); Map beans = this.context @@ -79,8 +79,8 @@ public class PersistenceExceptionTranslationAutoConfigurationTests { @Test public void exceptionTranslationPostProcessorCanBeDisabled() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.dao.exceptiontranslation.enabled=false").applyTo(this.context); + TestPropertyValues.of("spring.dao.exceptiontranslation.enabled=false") + .applyTo(this.context); this.context.register(PersistenceExceptionTranslationAutoConfiguration.class); this.context.refresh(); Map beans = this.context diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationIntegrationTests.java index 24d9177234..f3c0983965 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationIntegrationTests.java @@ -71,9 +71,10 @@ public class CassandraDataAutoConfigurationIntegrationTests { this.context = new AnnotationConfigApplicationContext(); String cityPackage = City.class.getPackage().getName(); AutoConfigurationPackages.register(this.context, cityPackage); - TestPropertyValues.of( - "spring.data.cassandra.schemaAction=recreate_drop_unused", - "spring.data.cassandra.keyspaceName=boot_test").applyTo(this.context); + TestPropertyValues + .of("spring.data.cassandra.schemaAction=recreate_drop_unused", + "spring.data.cassandra.keyspaceName=boot_test") + .applyTo(this.context); this.context.register(CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class); this.context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationTests.java index 7e9699a601..3a1670fd3f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationTests.java @@ -60,8 +60,8 @@ public class CassandraDataAutoConfigurationTests { @Test public void templateExists() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.cassandra.keyspaceName:boot_test").applyTo(this.context); + TestPropertyValues.of("spring.data.cassandra.keyspaceName:boot_test") + .applyTo(this.context); this.context.register(TestExcludeConfiguration.class, TestConfiguration.class, PropertyPlaceholderAutoConfiguration.class, CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class); @@ -74,8 +74,7 @@ public class CassandraDataAutoConfigurationTests { @SuppressWarnings("unchecked") public void entityScanShouldSetInitialEntitySet() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.cassandra.keyspaceName:boot_test"); + TestPropertyValues.of("spring.data.cassandra.keyspaceName:boot_test"); this.context.register(TestConfiguration.class, EntityScanConfig.class, PropertyPlaceholderAutoConfiguration.class, CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class); @@ -90,8 +89,8 @@ public class CassandraDataAutoConfigurationTests { @Test public void userTypeResolverShouldBeSet() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.cassandra.keyspaceName:boot_test").applyTo(this.context); + TestPropertyValues.of("spring.data.cassandra.keyspaceName:boot_test") + .applyTo(this.context); this.context.register(TestConfiguration.class, PropertyPlaceholderAutoConfiguration.class, CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfigurationTests.java index 65eb45889d..1c9297b60b 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfigurationTests.java @@ -55,9 +55,10 @@ public class ElasticsearchAutoConfigurationTests { @Test public void createNodeClientWithDefaults() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.elasticsearch.properties.foo.bar:baz", - "spring.data.elasticsearch.properties.path.home:target").applyTo(this.context); + TestPropertyValues + .of("spring.data.elasticsearch.properties.foo.bar:baz", + "spring.data.elasticsearch.properties.path.home:target") + .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class); this.context.refresh(); @@ -71,12 +72,13 @@ public class ElasticsearchAutoConfigurationTests { @Test public void createNodeClientWithOverrides() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.elasticsearch.properties.foo.bar:baz", - "spring.data.elasticsearch.properties.path.home:target", - "spring.data.elasticsearch.properties.node.local:false", - "spring.data.elasticsearch.properties.node.data:true", - "spring.data.elasticsearch.properties.http.enabled:true").applyTo(this.context); + TestPropertyValues + .of("spring.data.elasticsearch.properties.foo.bar:baz", + "spring.data.elasticsearch.properties.path.home:target", + "spring.data.elasticsearch.properties.node.local:false", + "spring.data.elasticsearch.properties.node.data:true", + "spring.data.elasticsearch.properties.http.enabled:true") + .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class); this.context.refresh(); @@ -105,9 +107,10 @@ public class ElasticsearchAutoConfigurationTests { // We don't have a local elasticsearch server so use an address that's missing // a port and check the exception this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.elasticsearch.cluster-nodes:localhost", - "spring.data.elasticsearch.properties.path.home:target").applyTo(this.context); + TestPropertyValues + .of("spring.data.elasticsearch.cluster-nodes:localhost", + "spring.data.elasticsearch.properties.path.home:target") + .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class); this.thrown.expect(BeanCreationException.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchDataAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchDataAutoConfigurationTests.java index 95c37ca184..d7c9518e7e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchDataAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchDataAutoConfigurationTests.java @@ -48,9 +48,9 @@ public class ElasticsearchDataAutoConfigurationTests { @Test public void templateExists() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.elasticsearch.properties.path.data:target/data", - "spring.data.elasticsearch.properties.path.logs:target/logs") + TestPropertyValues + .of("spring.data.elasticsearch.properties.path.data:target/data", + "spring.data.elasticsearch.properties.path.logs:target/logs") .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class, @@ -63,9 +63,9 @@ public class ElasticsearchDataAutoConfigurationTests { @Test public void mappingContextExists() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.elasticsearch.properties.path.data:target/data", - "spring.data.elasticsearch.properties.path.logs:target/logs") + TestPropertyValues + .of("spring.data.elasticsearch.properties.path.data:target/data", + "spring.data.elasticsearch.properties.path.logs:target/logs") .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class, @@ -79,9 +79,9 @@ public class ElasticsearchDataAutoConfigurationTests { @Test public void converterExists() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.elasticsearch.properties.path.data:target/data", - "spring.data.elasticsearch.properties.path.logs:target/logs") + TestPropertyValues + .of("spring.data.elasticsearch.properties.path.data:target/data", + "spring.data.elasticsearch.properties.path.logs:target/logs") .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesAutoConfigurationTests.java index 06f9f37ecd..b2b1e4b5b2 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesAutoConfigurationTests.java @@ -88,8 +88,8 @@ public class ElasticsearchRepositoriesAutoConfigurationTests { } private void addElasticsearchProperties(AnnotationConfigApplicationContext context) { - TestPropertyValues.of( - "spring.data.elasticsearch.properties.path.home:target").applyTo(context); + TestPropertyValues.of("spring.data.elasticsearch.properties.path.home:target") + .applyTo(context); } @Configuration diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/ldap/LdapDataAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/ldap/LdapDataAutoConfigurationTests.java index b4181f8dce..106fb74625 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/ldap/LdapDataAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/ldap/LdapDataAutoConfigurationTests.java @@ -46,8 +46,8 @@ public class LdapDataAutoConfigurationTests { @Test public void templateExists() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.ldap.urls:ldap://localhost:389").applyTo(this.context); + TestPropertyValues.of("spring.ldap.urls:ldap://localhost:389") + .applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, LdapAutoConfiguration.class, LdapDataAutoConfiguration.class); this.context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/ldap/LdapRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/ldap/LdapRepositoriesAutoConfigurationTests.java index 6a093dd026..d99ba23d38 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/ldap/LdapRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/ldap/LdapRepositoriesAutoConfigurationTests.java @@ -69,8 +69,8 @@ public class LdapRepositoriesAutoConfigurationTests { private void load(Class... configurationClasses) { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.ldap.urls:ldap://localhost:389").applyTo(this.context); + TestPropertyValues.of("spring.ldap.urls:ldap://localhost:389") + .applyTo(this.context); this.context.register(configurationClasses); this.context.register(LdapAutoConfiguration.class, LdapDataAutoConfiguration.class, LdapRepositoriesAutoConfiguration.class, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java index e7cb00677f..17e3f17446 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java @@ -62,8 +62,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests { @Test public void testDefaultRepositoryConfiguration() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.datasource.initialize:false").applyTo(this.context); + TestPropertyValues.of("spring.datasource.initialize:false").applyTo(this.context); this.context.register(TestConfiguration.class, BaseConfiguration.class); this.context.refresh(); assertThat(this.context.getBean(CountryRepository.class)).isNotNull(); @@ -72,8 +71,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests { @Test public void testMixedRepositoryConfiguration() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.datasource.initialize:false").applyTo(this.context); + TestPropertyValues.of("spring.datasource.initialize:false").applyTo(this.context); this.context.register(MixedConfiguration.class, BaseConfiguration.class); this.context.refresh(); assertThat(this.context.getBean(CountryRepository.class)).isNotNull(); @@ -83,8 +81,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests { @Test public void testJpaRepositoryConfigurationWithMongoTemplate() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.datasource.initialize:false").applyTo(this.context); + TestPropertyValues.of("spring.datasource.initialize:false").applyTo(this.context); this.context.register(JpaConfiguration.class, BaseConfiguration.class); this.context.refresh(); assertThat(this.context.getBean(CityRepository.class)).isNotNull(); @@ -93,8 +90,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests { @Test public void testJpaRepositoryConfigurationWithMongoOverlap() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.datasource.initialize:false").applyTo(this.context); + TestPropertyValues.of("spring.datasource.initialize:false").applyTo(this.context); this.context.register(OverlapConfiguration.class, BaseConfiguration.class); this.context.refresh(); assertThat(this.context.getBean(CityRepository.class)).isNotNull(); @@ -104,9 +100,10 @@ public class MixedMongoRepositoriesAutoConfigurationTests { public void testJpaRepositoryConfigurationWithMongoOverlapDisabled() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.datasource.initialize:false", - "spring.data.mongodb.repositories.enabled:false").applyTo(this.context); + TestPropertyValues + .of("spring.datasource.initialize:false", + "spring.data.mongodb.repositories.enabled:false") + .applyTo(this.context); this.context.register(OverlapConfiguration.class, BaseConfiguration.class); this.context.refresh(); assertThat(this.context.getBean(CityRepository.class)).isNotNull(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java index 9769747f30..ea1766f05e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java @@ -86,8 +86,7 @@ public class MongoDataAutoConfigurationTests { @Test public void gridFsTemplateExists() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.mongodb.gridFsDatabase:grid"); + TestPropertyValues.of("spring.data.mongodb.gridFsDatabase:grid"); this.context.register(PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class, MongoDataAutoConfiguration.class); this.context.refresh(); @@ -180,8 +179,8 @@ public class MongoDataAutoConfigurationTests { Class expectedType) { this.context = new AnnotationConfigApplicationContext(); if (strategy != null) { - TestPropertyValues.of( - "spring.data.mongodb.field-naming-strategy:" + strategy).applyTo(this.context); + TestPropertyValues.of("spring.data.mongodb.field-naming-strategy:" + strategy) + .applyTo(this.context); } this.context.register(PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class, MongoDataAutoConfiguration.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoReactiveAndBlockingRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoReactiveAndBlockingRepositoriesAutoConfigurationTests.java index 58098b0a4e..73b44b42af 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoReactiveAndBlockingRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoReactiveAndBlockingRepositoriesAutoConfigurationTests.java @@ -58,8 +58,7 @@ public class MongoReactiveAndBlockingRepositoriesAutoConfigurationTests { public void shouldCreateInstancesForReactiveAndBlockingRepositories() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.datasource.initialize:false").applyTo(this.context); + TestPropertyValues.of("spring.datasource.initialize:false").applyTo(this.context); this.context.register(BlockingAndReactiveConfiguration.class, BaseConfiguration.class); this.context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfigurationTests.java index 0a02ebd4ae..72ba1b6dec 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfigurationTests.java @@ -82,8 +82,8 @@ public class Neo4jRepositoriesAutoConfigurationTests { private void prepareApplicationContext(Class... configurationClasses) { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.neo4j.uri=http://localhost:9797").applyTo(this.context); + TestPropertyValues.of("spring.data.neo4j.uri=http://localhost:9797") + .applyTo(this.context); this.context.register(configurationClasses); this.context.register(Neo4jDataAutoConfiguration.class, Neo4jRepositoriesAutoConfiguration.class, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/web/SpringDataWebAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/web/SpringDataWebAutoConfigurationTests.java index 19e719b414..2abc906fe8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/web/SpringDataWebAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/web/SpringDataWebAutoConfigurationTests.java @@ -99,8 +99,7 @@ public class SpringDataWebAutoConfigurationTests { } private void load(String... environment) { - AnnotationConfigWebApplicationContext ctx = - new AnnotationConfigWebApplicationContext(); + AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); TestPropertyValues.of(environment).applyTo(ctx); ctx.register(SpringDataWebAutoConfiguration.class); ctx.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java index 6ab718e627..aa7b2034b1 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java @@ -76,8 +76,7 @@ public class FlywayAutoConfigurationTests { @Before public void init() { - TestPropertyValues.of( - "spring.datasource.name:flywaytest").applyTo(this.context); + TestPropertyValues.of("spring.datasource.name:flywaytest").applyTo(this.context); } @After @@ -96,8 +95,8 @@ public class FlywayAutoConfigurationTests { @Test public void createDataSource() throws Exception { - TestPropertyValues.of( - "flyway.url:jdbc:hsqldb:mem:flywaytest", "flyway.user:sa").applyTo(this.context); + TestPropertyValues.of("flyway.url:jdbc:hsqldb:mem:flywaytest", "flyway.user:sa") + .applyTo(this.context); registerAndRefresh(EmbeddedDataSourceConfiguration.class, FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -126,8 +125,9 @@ public class FlywayAutoConfigurationTests { @Test public void overrideLocations() throws Exception { - TestPropertyValues.of( - "flyway.locations:classpath:db/changelog,classpath:db/migration").applyTo(this.context); + TestPropertyValues + .of("flyway.locations:classpath:db/changelog,classpath:db/migration") + .applyTo(this.context); registerAndRefresh(EmbeddedDataSourceConfiguration.class, FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -138,9 +138,10 @@ public class FlywayAutoConfigurationTests { @Test public void overrideLocationsList() throws Exception { - TestPropertyValues.of( - "flyway.locations[0]:classpath:db/changelog", - "flyway.locations[1]:classpath:db/migration").applyTo(this.context); + TestPropertyValues + .of("flyway.locations[0]:classpath:db/changelog", + "flyway.locations[1]:classpath:db/migration") + .applyTo(this.context); registerAndRefresh(EmbeddedDataSourceConfiguration.class, FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -161,8 +162,7 @@ public class FlywayAutoConfigurationTests { @Test public void changeLogDoesNotExist() throws Exception { - TestPropertyValues.of( - "flyway.locations:file:no-such-dir").applyTo(this.context); + TestPropertyValues.of("flyway.locations:file:no-such-dir").applyTo(this.context); this.thrown.expect(BeanCreationException.class); registerAndRefresh(EmbeddedDataSourceConfiguration.class, FlywayAutoConfiguration.class, @@ -171,9 +171,10 @@ public class FlywayAutoConfigurationTests { @Test public void checkLocationsAllMissing() throws Exception { - TestPropertyValues.of( - "flyway.locations:classpath:db/missing1,classpath:db/migration2", - "flyway.check-location:true").applyTo(this.context); + TestPropertyValues + .of("flyway.locations:classpath:db/missing1,classpath:db/migration2", + "flyway.check-location:true") + .applyTo(this.context); this.thrown.expect(BeanCreationException.class); this.thrown.expectMessage("Cannot find migrations location in"); registerAndRefresh(EmbeddedDataSourceConfiguration.class, @@ -183,9 +184,10 @@ public class FlywayAutoConfigurationTests { @Test public void checkLocationsAllExist() throws Exception { - TestPropertyValues.of( - "flyway.locations:classpath:db/changelog,classpath:db/migration", - "flyway.check-location:true").applyTo(this.context); + TestPropertyValues + .of("flyway.locations:classpath:db/changelog,classpath:db/migration", + "flyway.check-location:true") + .applyTo(this.context); registerAndRefresh(EmbeddedDataSourceConfiguration.class, FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -245,8 +247,9 @@ public class FlywayAutoConfigurationTests { @Test public void useVendorDirectory() throws Exception { - TestPropertyValues.of( - "flyway.locations=classpath:db/vendors/{vendor},classpath:db/changelog").applyTo(this.context); + TestPropertyValues + .of("flyway.locations=classpath:db/vendors/{vendor},classpath:db/changelog") + .applyTo(this.context); registerAndRefresh(EmbeddedDataSourceConfiguration.class, FlywayAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java index 9a7aac8763..27891723b6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -101,8 +101,8 @@ public class GroovyTemplateAutoConfigurationTests { @Test public void disableViewResolution() throws Exception { - TestPropertyValues.of( - "spring.groovy.template.enabled:false").applyTo(this.context); + TestPropertyValues.of("spring.groovy.template.enabled:false") + .applyTo(this.context); registerAndRefreshContext(); assertThat(this.context.getBeanNamesForType(ViewResolver.class)).isEmpty(); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfigurationTests.java index 6341f887e9..4beba145ab 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfigurationTests.java @@ -66,8 +66,7 @@ public class H2ConsoleAutoConfigurationTests { @Test public void propertyCanEnableConsole() { this.context.register(H2ConsoleAutoConfiguration.class); - TestPropertyValues.of( - "spring.h2.console.enabled:true").applyTo(this.context); + TestPropertyValues.of("spring.h2.console.enabled:true").applyTo(this.context); this.context.refresh(); assertThat(this.context.getBeansOfType(ServletRegistrationBean.class)).hasSize(1); ServletRegistrationBean registrationBean = this.context @@ -83,16 +82,18 @@ public class H2ConsoleAutoConfigurationTests { this.thrown.expect(BeanCreationException.class); this.thrown.expectMessage("Failed to bind properties under 'spring.h2.console'"); this.context.register(H2ConsoleAutoConfiguration.class); - TestPropertyValues.of( - "spring.h2.console.enabled:true", "spring.h2.console.path:custom").applyTo(this.context); + TestPropertyValues + .of("spring.h2.console.enabled:true", "spring.h2.console.path:custom") + .applyTo(this.context); this.context.refresh(); } @Test public void customPathWithTrailingSlash() { this.context.register(H2ConsoleAutoConfiguration.class); - TestPropertyValues.of( - "spring.h2.console.enabled:true", "spring.h2.console.path:/custom/").applyTo(this.context); + TestPropertyValues + .of("spring.h2.console.enabled:true", "spring.h2.console.path:/custom/") + .applyTo(this.context); this.context.refresh(); assertThat(this.context.getBeansOfType(ServletRegistrationBean.class)).hasSize(1); ServletRegistrationBean servletRegistrationBean = this.context @@ -103,8 +104,9 @@ public class H2ConsoleAutoConfigurationTests { @Test public void customPath() { this.context.register(H2ConsoleAutoConfiguration.class); - TestPropertyValues.of( - "spring.h2.console.enabled:true", "spring.h2.console.path:/custom").applyTo(this.context); + TestPropertyValues + .of("spring.h2.console.enabled:true", "spring.h2.console.path:/custom") + .applyTo(this.context); this.context.refresh(); assertThat(this.context.getBeansOfType(ServletRegistrationBean.class)).hasSize(1); ServletRegistrationBean servletRegistrationBean = this.context @@ -115,9 +117,11 @@ public class H2ConsoleAutoConfigurationTests { @Test public void customInitParameters() { this.context.register(H2ConsoleAutoConfiguration.class); - TestPropertyValues.of( - "spring.h2.console.enabled:true", "spring.h2.console.settings.trace=true", - "spring.h2.console.settings.webAllowOthers=true").applyTo(this.context); + TestPropertyValues + .of("spring.h2.console.enabled:true", + "spring.h2.console.settings.trace=true", + "spring.h2.console.settings.webAllowOthers=true") + .applyTo(this.context); this.context.refresh(); assertThat(this.context.getBeansOfType(ServletRegistrationBean.class)).hasSize(1); ServletRegistrationBean registrationBean = this.context diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java index 5fdeabedeb..bd950b2ee3 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java @@ -88,8 +88,8 @@ public class HypermediaAutoConfigurationTests { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(EnableHypermediaSupportConfig.class, BaseConfig.class); - TestPropertyValues.of( - "spring.jackson.serialization.INDENT_OUTPUT:true").applyTo(this.context); + TestPropertyValues.of("spring.jackson.serialization.INDENT_OUTPUT:true") + .applyTo(this.context); this.context.refresh(); ObjectMapper objectMapper = this.context.getBean("_halObjectMapper", ObjectMapper.class); @@ -102,8 +102,8 @@ public class HypermediaAutoConfigurationTests { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(BaseConfig.class); - TestPropertyValues.of( - "spring.jackson.serialization.INDENT_OUTPUT:true").applyTo(this.context); + TestPropertyValues.of("spring.jackson.serialization.INDENT_OUTPUT:true") + .applyTo(this.context); this.context.refresh(); ObjectMapper objectMapper = this.context.getBean("_halObjectMapper", ObjectMapper.class); @@ -132,8 +132,8 @@ public class HypermediaAutoConfigurationTests { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(BaseConfig.class); - TestPropertyValues.of( - "spring.hateoas.use-hal-as-default-json-media-type:false").applyTo(this.context); + TestPropertyValues.of("spring.hateoas.use-hal-as-default-json-media-type:false") + .applyTo(this.context); this.context.refresh(); RequestMappingHandlerAdapter handlerAdapter = this.context .getBean(RequestMappingHandlerAdapter.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java index c16bab0ff9..592eb34243 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java @@ -153,8 +153,8 @@ public class HttpMessageConvertersAutoConfigurationTests { public void gsonCanBePreferredWhenBothGsonAndJacksonAreAvailable() { this.context.register(GsonAutoConfiguration.class, JacksonAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class); - TestPropertyValues.of( - "spring.http.converters.preferred-json-mapper:gson").applyTo(this.context); + TestPropertyValues.of("spring.http.converters.preferred-json-mapper:gson") + .applyTo(this.context); this.context.refresh(); assertConverterBeanExists(GsonHttpMessageConverter.class, "gsonHttpMessageConverter"); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java index 5d3cb57ad5..41ffc0fcbd 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java @@ -126,8 +126,8 @@ public class JacksonAutoConfigurationTests { @Test public void customDateFormat() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.date-format:yyyyMMddHHmmss").applyTo(this.context); + TestPropertyValues.of("spring.jackson.date-format:yyyyMMddHHmmss") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); DateFormat dateFormat = mapper.getDateFormat(); @@ -139,9 +139,10 @@ public class JacksonAutoConfigurationTests { @Test public void customJodaDateTimeFormat() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.date-format:yyyyMMddHHmmss", - "spring.jackson.joda-date-time-format:yyyy-MM-dd HH:mm:ss").applyTo(this.context); + TestPropertyValues + .of("spring.jackson.date-format:yyyyMMddHHmmss", + "spring.jackson.joda-date-time-format:yyyy-MM-dd HH:mm:ss") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); DateTime dateTime = new DateTime(1988, 6, 25, 20, 30, DateTimeZone.UTC); @@ -154,8 +155,9 @@ public class JacksonAutoConfigurationTests { @Test public void customDateFormatClass() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.date-format:org.springframework.boot.autoconfigure.jackson.JacksonAutoConfigurationTests.MyDateFormat").applyTo(this.context); + TestPropertyValues + .of("spring.jackson.date-format:org.springframework.boot.autoconfigure.jackson.JacksonAutoConfigurationTests.MyDateFormat") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(mapper.getDateFormat()).isInstanceOf(MyDateFormat.class); @@ -172,8 +174,8 @@ public class JacksonAutoConfigurationTests { @Test public void customPropertyNamingStrategyField() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.property-naming-strategy:SNAKE_CASE").applyTo(this.context); + TestPropertyValues.of("spring.jackson.property-naming-strategy:SNAKE_CASE") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(mapper.getPropertyNamingStrategy()) @@ -183,8 +185,9 @@ public class JacksonAutoConfigurationTests { @Test public void customPropertyNamingStrategyClass() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.property-naming-strategy:com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy").applyTo(this.context); + TestPropertyValues + .of("spring.jackson.property-naming-strategy:com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(mapper.getPropertyNamingStrategy()) @@ -194,8 +197,8 @@ public class JacksonAutoConfigurationTests { @Test public void enableSerializationFeature() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.serialization.indent_output:true").applyTo(this.context); + TestPropertyValues.of("spring.jackson.serialization.indent_output:true") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(SerializationFeature.INDENT_OUTPUT.enabledByDefault()).isFalse(); @@ -207,8 +210,9 @@ public class JacksonAutoConfigurationTests { @Test public void disableSerializationFeature() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.serialization.write_dates_as_timestamps:false").applyTo(this.context); + TestPropertyValues + .of("spring.jackson.serialization.write_dates_as_timestamps:false") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS.enabledByDefault()) @@ -220,8 +224,9 @@ public class JacksonAutoConfigurationTests { @Test public void enableDeserializationFeature() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.deserialization.use_big_decimal_for_floats:true").applyTo(this.context); + TestPropertyValues + .of("spring.jackson.deserialization.use_big_decimal_for_floats:true") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS.enabledByDefault()) @@ -233,8 +238,9 @@ public class JacksonAutoConfigurationTests { @Test public void disableDeserializationFeature() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.deserialization.fail-on-unknown-properties:false").applyTo(this.context); + TestPropertyValues + .of("spring.jackson.deserialization.fail-on-unknown-properties:false") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES.enabledByDefault()) @@ -246,8 +252,8 @@ public class JacksonAutoConfigurationTests { @Test public void enableMapperFeature() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.mapper.require_setters_for_getters:true").applyTo(this.context); + TestPropertyValues.of("spring.jackson.mapper.require_setters_for_getters:true") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS.enabledByDefault()) @@ -263,8 +269,8 @@ public class JacksonAutoConfigurationTests { @Test public void disableMapperFeature() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.mapper.use_annotations:false").applyTo(this.context); + TestPropertyValues.of("spring.jackson.mapper.use_annotations:false") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(MapperFeature.USE_ANNOTATIONS.enabledByDefault()).isTrue(); @@ -277,8 +283,8 @@ public class JacksonAutoConfigurationTests { @Test public void enableParserFeature() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.parser.allow_single_quotes:true").applyTo(this.context); + TestPropertyValues.of("spring.jackson.parser.allow_single_quotes:true") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(JsonParser.Feature.ALLOW_SINGLE_QUOTES.enabledByDefault()).isFalse(); @@ -289,8 +295,8 @@ public class JacksonAutoConfigurationTests { @Test public void disableParserFeature() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.parser.auto_close_source:false").applyTo(this.context); + TestPropertyValues.of("spring.jackson.parser.auto_close_source:false") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(JsonParser.Feature.AUTO_CLOSE_SOURCE.enabledByDefault()).isTrue(); @@ -301,8 +307,8 @@ public class JacksonAutoConfigurationTests { @Test public void enableGeneratorFeature() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.generator.write_numbers_as_strings:true").applyTo(this.context); + TestPropertyValues.of("spring.jackson.generator.write_numbers_as_strings:true") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS.enabledByDefault()) @@ -314,8 +320,8 @@ public class JacksonAutoConfigurationTests { @Test public void disableGeneratorFeature() throws Exception { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.generator.auto_close_target:false").applyTo(this.context); + TestPropertyValues.of("spring.jackson.generator.auto_close_target:false") + .applyTo(this.context); this.context.refresh(); ObjectMapper mapper = this.context.getBean(ObjectMapper.class); assertThat(JsonGenerator.Feature.AUTO_CLOSE_TARGET.enabledByDefault()).isTrue(); @@ -369,8 +375,8 @@ public class JacksonAutoConfigurationTests { @Test public void customSerializationInclusion() { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.default-property-inclusion:non_null").applyTo(this.context); + TestPropertyValues.of("spring.jackson.default-property-inclusion:non_null") + .applyTo(this.context); this.context.refresh(); ObjectMapper objectMapper = this.context .getBean(Jackson2ObjectMapperBuilder.class).build(); @@ -381,10 +387,9 @@ public class JacksonAutoConfigurationTests { @Test public void customTimeZoneFormattingADateTime() throws JsonProcessingException { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.time-zone:America/Los_Angeles").applyTo(this.context); - TestPropertyValues.of( - "spring.jackson.date-format:zzzz").applyTo(this.context); + TestPropertyValues.of("spring.jackson.time-zone:America/Los_Angeles") + .applyTo(this.context); + TestPropertyValues.of("spring.jackson.date-format:zzzz").applyTo(this.context); TestPropertyValues.of("spring.jackson.locale:en").applyTo(this.context); this.context.refresh(); ObjectMapper objectMapper = this.context @@ -397,8 +402,7 @@ public class JacksonAutoConfigurationTests { @Test public void customTimeZoneFormattingADate() throws JsonProcessingException { this.context.register(JacksonAutoConfiguration.class); - TestPropertyValues.of( - "spring.jackson.time-zone:GMT+10").applyTo(this.context); + TestPropertyValues.of("spring.jackson.time-zone:GMT+10").applyTo(this.context); TestPropertyValues.of("spring.jackson.date-format:z").applyTo(this.context); this.context.refresh(); ObjectMapper objectMapper = this.context @@ -411,8 +415,7 @@ public class JacksonAutoConfigurationTests { public void customLocale() throws JsonProcessingException { this.context.register(JacksonAutoConfiguration.class); TestPropertyValues.of("spring.jackson.locale:de").applyTo(this.context); - TestPropertyValues.of( - "spring.jackson.date-format:zzzz").applyTo(this.context); + TestPropertyValues.of("spring.jackson.date-format:zzzz").applyTo(this.context); this.context.refresh(); ObjectMapper objectMapper = this.context .getBean(Jackson2ObjectMapperBuilder.class).build(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java index 8988fd2c8d..d9b6d60e21 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java @@ -58,9 +58,9 @@ public class DataSourceAutoConfigurationTests { @Before public void init() { EmbeddedDatabaseConnection.override = null; - TestPropertyValues.of( - "spring.datasource.initialize:false", - "spring.datasource.url:jdbc:hsqldb:mem:testdb-" + new Random().nextInt()).applyTo(this.context); + TestPropertyValues.of("spring.datasource.initialize:false", + "spring.datasource.url:jdbc:hsqldb:mem:testdb-" + new Random().nextInt()) + .applyTo(this.context); } @After @@ -89,8 +89,8 @@ public class DataSourceAutoConfigurationTests { @Test(expected = BeanCreationException.class) public void testBadUrl() throws Exception { - TestPropertyValues.of( - "spring.datasource.url:jdbc:not-going-to-work").applyTo(this.context); + TestPropertyValues.of("spring.datasource.url:jdbc:not-going-to-work") + .applyTo(this.context); EmbeddedDatabaseConnection.override = EmbeddedDatabaseConnection.NONE; this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -100,9 +100,10 @@ public class DataSourceAutoConfigurationTests { @Test(expected = BeanCreationException.class) public void testBadDriverClass() throws Exception { - TestPropertyValues.of( - "spring.datasource.driverClassName:org.none.jdbcDriver", - "spring.datasource.url:jdbc:hsqldb:mem:testdb").applyTo(this.context); + TestPropertyValues + .of("spring.datasource.driverClassName:org.none.jdbcDriver", + "spring.datasource.url:jdbc:hsqldb:mem:testdb") + .applyTo(this.context); EmbeddedDatabaseConnection.override = EmbeddedDatabaseConnection.NONE; this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -152,9 +153,10 @@ public class DataSourceAutoConfigurationTests { @Test public void testEmbeddedTypeDefaultsUsername() throws Exception { - TestPropertyValues.of( - "spring.datasource.driverClassName:org.hsqldb.jdbcDriver", - "spring.datasource.url:jdbc:hsqldb:mem:testdb").applyTo(this.context); + TestPropertyValues + .of("spring.datasource.driverClassName:org.hsqldb.jdbcDriver", + "spring.datasource.url:jdbc:hsqldb:mem:testdb") + .applyTo(this.context); this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); @@ -172,10 +174,12 @@ public class DataSourceAutoConfigurationTests { */ @Test public void explicitTypeNoSupportedDataSource() { - TestPropertyValues.of( - "spring.datasource.driverClassName:org.hsqldb.jdbcDriver", - "spring.datasource.url:jdbc:hsqldb:mem:testdb", - "spring.datasource.type:" + SimpleDriverDataSource.class.getName()).applyTo(this.context); + TestPropertyValues + .of("spring.datasource.driverClassName:org.hsqldb.jdbcDriver", + "spring.datasource.url:jdbc:hsqldb:mem:testdb", + "spring.datasource.type:" + + SimpleDriverDataSource.class.getName()) + .applyTo(this.context); this.context.setClassLoader( new HidePackagesClassLoader("org.apache.tomcat", "com.zaxxer.hikari", "org.apache.commons.dbcp", "org.apache.commons.dbcp2")); @@ -184,10 +188,12 @@ public class DataSourceAutoConfigurationTests { @Test public void explicitTypeSupportedDataSource() { - TestPropertyValues.of( - "spring.datasource.driverClassName:org.hsqldb.jdbcDriver", - "spring.datasource.url:jdbc:hsqldb:mem:testdb", - "spring.datasource.type:" + SimpleDriverDataSource.class.getName()).applyTo(this.context); + TestPropertyValues + .of("spring.datasource.driverClassName:org.hsqldb.jdbcDriver", + "spring.datasource.url:jdbc:hsqldb:mem:testdb", + "spring.datasource.type:" + + SimpleDriverDataSource.class.getName()) + .applyTo(this.context); testExplicitType(); } @@ -232,9 +238,10 @@ public class DataSourceAutoConfigurationTests { @SuppressWarnings("unchecked") private T autoConfigureDataSource(Class expectedType, final String... hiddenPackages) { - TestPropertyValues.of( - "spring.datasource.driverClassName:org.hsqldb.jdbcDriver", - "spring.datasource.url:jdbc:hsqldb:mem:testdb").applyTo(this.context); + TestPropertyValues + .of("spring.datasource.driverClassName:org.hsqldb.jdbcDriver", + "spring.datasource.url:jdbc:hsqldb:mem:testdb") + .applyTo(this.context); this.context.setClassLoader(new HidePackagesClassLoader(hiddenPackages)); this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java index 391f9c4d78..9e3c49d916 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java @@ -69,9 +69,9 @@ public class DataSourceInitializerTests { @Before public void init() { EmbeddedDatabaseConnection.override = null; - TestPropertyValues.of( - "spring.datasource.initialize:false", - "spring.datasource.url:jdbc:hsqldb:mem:testdb-" + new Random().nextInt()).applyTo(this.context); + TestPropertyValues.of("spring.datasource.initialize:false", + "spring.datasource.url:jdbc:hsqldb:mem:testdb-" + new Random().nextInt()) + .applyTo(this.context); } @After @@ -93,8 +93,7 @@ public class DataSourceInitializerTests { @Test public void testTwoDataSources() throws Exception { - TestPropertyValues.of( - "datasource.one.url=jdbc:hsqldb:mem:/one", + TestPropertyValues.of("datasource.one.url=jdbc:hsqldb:mem:/one", "datasource.two.url=jdbc:hsqldb:mem:/two").applyTo(this.context); this.context.register(TwoDataSources.class, DataSourceInitializer.class, PropertyPlaceholderAutoConfiguration.class, DataSourceProperties.class); @@ -105,8 +104,7 @@ public class DataSourceInitializerTests { @Test public void testDataSourceInitialized() throws Exception { - TestPropertyValues.of( - "spring.datasource.initialize:true").applyTo(this.context); + TestPropertyValues.of("spring.datasource.initialize:true").applyTo(this.context); this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); @@ -122,12 +120,13 @@ public class DataSourceInitializerTests { public void testDataSourceInitializedWithExplicitScript() throws Exception { this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); - TestPropertyValues.of( - "spring.datasource.initialize:true", - "spring.datasource.schema:" + ClassUtils - .addResourcePathToPackagePath(getClass(), "schema.sql"), - "spring.datasource.data:" + ClassUtils - .addResourcePathToPackagePath(getClass(), "data.sql")).applyTo(this.context); + TestPropertyValues + .of("spring.datasource.initialize:true", + "spring.datasource.schema:" + ClassUtils + .addResourcePathToPackagePath(getClass(), "schema.sql"), + "spring.datasource.data:" + + ClassUtils.addResourcePathToPackagePath(getClass(), "data.sql")) + .applyTo(this.context); this.context.refresh(); DataSource dataSource = this.context.getBean(DataSource.class); assertThat(dataSource).isInstanceOf(HikariDataSource.class); @@ -139,16 +138,17 @@ public class DataSourceInitializerTests { @Test public void testDataSourceInitializedWithMultipleScripts() throws Exception { - TestPropertyValues.of( - "spring.datasource.initialize:true", - "spring.datasource.schema:" - + ClassUtils.addResourcePathToPackagePath(getClass(), - "schema.sql") + TestPropertyValues + .of("spring.datasource.initialize:true", + "spring.datasource.schema:" + + ClassUtils.addResourcePathToPackagePath(getClass(), + "schema.sql") + "," + ClassUtils.addResourcePathToPackagePath(getClass(), "another.sql"), - "spring.datasource.data:" + ClassUtils - .addResourcePathToPackagePath(getClass(), "data.sql")).applyTo(this.context); + "spring.datasource.data:" + + ClassUtils.addResourcePathToPackagePath(getClass(), "data.sql")) + .applyTo(this.context); this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); @@ -167,13 +167,13 @@ public class DataSourceInitializerTests { throws Exception { this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); - TestPropertyValues.of( - "spring.datasource.initialize:true", + TestPropertyValues.of("spring.datasource.initialize:true", "spring.datasource.sqlScriptEncoding:UTF-8", "spring.datasource.schema:" + ClassUtils .addResourcePathToPackagePath(getClass(), "encoding-schema.sql"), "spring.datasource.data:" + ClassUtils - .addResourcePathToPackagePath(getClass(), "encoding-data.sql")).applyTo(this.context); + .addResourcePathToPackagePath(getClass(), "encoding-data.sql")) + .applyTo(this.context); this.context.refresh(); DataSource dataSource = this.context.getBean(DataSource.class); assertThat(dataSource).isInstanceOf(HikariDataSource.class); @@ -214,8 +214,7 @@ public class DataSourceInitializerTests { public void testDataSourceInitializedWithSchemaCredentials() { this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); - TestPropertyValues.of( - "spring.datasource.initialize:true", + TestPropertyValues.of("spring.datasource.initialize:true", "spring.datasource.sqlScriptEncoding:UTF-8", "spring.datasource.schema:" + ClassUtils .addResourcePathToPackagePath(getClass(), "encoding-schema.sql"), @@ -236,8 +235,7 @@ public class DataSourceInitializerTests { public void testDataSourceInitializedWithDataCredentials() { this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); - TestPropertyValues.of( - "spring.datasource.initialize:true", + TestPropertyValues.of("spring.datasource.initialize:true", "spring.datasource.sqlScriptEncoding:UTF-8", "spring.datasource.schema:" + ClassUtils .addResourcePathToPackagePath(getClass(), "encoding-schema.sql"), @@ -256,12 +254,12 @@ public class DataSourceInitializerTests { @Test public void multipleScriptsAppliedInLexicalOrder() throws Exception { - TestPropertyValues.of( - "spring.datasource.initialize:true", + TestPropertyValues.of("spring.datasource.initialize:true", "spring.datasource.schema:" + ClassUtils .addResourcePathToPackagePath(getClass(), "lexical-schema-*.sql"), - "spring.datasource.data:" + ClassUtils - .addResourcePathToPackagePath(getClass(), "data.sql")).applyTo(this.context); + "spring.datasource.data:" + + ClassUtils.addResourcePathToPackagePath(getClass(), "data.sql")) + .applyTo(this.context); this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); ReverseOrderResourceLoader resourceLoader = new ReverseOrderResourceLoader( @@ -280,9 +278,10 @@ public class DataSourceInitializerTests { public void testDataSourceInitializedWithInvalidSchemaResource() { this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); - TestPropertyValues.of( - "spring.datasource.initialize:true", - "spring.datasource.schema:classpath:does/not/exist.sql").applyTo(this.context); + TestPropertyValues + .of("spring.datasource.initialize:true", + "spring.datasource.schema:classpath:does/not/exist.sql") + .applyTo(this.context); this.thrown.expect(BeanCreationException.class); this.thrown.expectMessage("does/not/exist.sql"); @@ -294,11 +293,12 @@ public class DataSourceInitializerTests { public void testDataSourceInitializedWithInvalidDataResource() { this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); - TestPropertyValues.of( - "spring.datasource.initialize:true", - "spring.datasource.schema:" + ClassUtils - .addResourcePathToPackagePath(getClass(), "schema.sql"), - "spring.datasource.data:classpath:does/not/exist.sql").applyTo(this.context); + TestPropertyValues + .of("spring.datasource.initialize:true", + "spring.datasource.schema:" + ClassUtils + .addResourcePathToPackagePath(getClass(), "schema.sql"), + "spring.datasource.data:classpath:does/not/exist.sql") + .applyTo(this.context); this.thrown.expect(BeanCreationException.class); this.thrown.expectMessage("does/not/exist.sql"); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java index 49f3a27b9c..07809f7eeb 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java @@ -110,9 +110,10 @@ public class DataSourceTransactionManagerAutoConfigurationTests { @Test public void testCustomizeDataSourceTransactionManagerUsingProperties() throws Exception { - TestPropertyValues.of( - "spring.transaction.default-timeout:30", - "spring.transaction.rollback-on-commit-failure:true").applyTo(this.context); + TestPropertyValues + .of("spring.transaction.default-timeout:30", + "spring.transaction.rollback-on-commit-failure:true") + .applyTo(this.context); this.context.register(EmbeddedDataSourceConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, TransactionAutoConfiguration.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java index 6715e1a19a..0894291251 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDataSourceConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,8 +61,8 @@ public class HikariDataSourceConfigurationTests { @Test public void testDataSourcePropertiesOverridden() throws Exception { this.context.register(HikariDataSourceConfiguration.class); - TestPropertyValues.of( - PREFIX + "jdbcUrl:jdbc:foo//bar/spam").applyTo(this.context); + TestPropertyValues.of(PREFIX + "jdbcUrl:jdbc:foo//bar/spam") + .applyTo(this.context); TestPropertyValues.of(PREFIX + "maxLifetime:1234").applyTo(this.context); this.context.refresh(); HikariDataSource ds = this.context.getBean(HikariDataSource.class); @@ -74,8 +74,10 @@ public class HikariDataSourceConfigurationTests { @Test public void testDataSourceGenericPropertiesOverridden() throws Exception { this.context.register(HikariDataSourceConfiguration.class); - TestPropertyValues.of(PREFIX - + "dataSourceProperties.dataSourceClassName:org.h2.JDBCDataSource").applyTo(this.context); + TestPropertyValues + .of(PREFIX + + "dataSourceProperties.dataSourceClassName:org.h2.JDBCDataSource") + .applyTo(this.context); this.context.refresh(); HikariDataSource ds = this.context.getBean(HikariDataSource.class); assertThat(ds.getDataSourceProperties().getProperty("dataSourceClassName")) diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDriverConfigurationFailureAnalyzerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDriverConfigurationFailureAnalyzerTests.java index e44030a43e..360d13cba6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDriverConfigurationFailureAnalyzerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/HikariDriverConfigurationFailureAnalyzerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,9 +61,10 @@ public class HikariDriverConfigurationFailureAnalyzerTests { private BeanCreationException createFailure(Class configuration) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.datasource.type=" + HikariDataSource.class.getName(), - "spring.datasource.hikari.data-source-class-name=com.example.Foo").applyTo(context); + TestPropertyValues + .of("spring.datasource.type=" + HikariDataSource.class.getName(), + "spring.datasource.hikari.data-source-class-name=com.example.Foo") + .applyTo(context); context.register(configuration); try { context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JdbcTemplateAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JdbcTemplateAutoConfigurationTests.java index de6fcf927f..7872950c2d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JdbcTemplateAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JdbcTemplateAutoConfigurationTests.java @@ -52,9 +52,9 @@ public class JdbcTemplateAutoConfigurationTests { @Before public void init() { EmbeddedDatabaseConnection.override = null; - TestPropertyValues.of( - "spring.datasource.initialize:false", - "spring.datasource.url:jdbc:hsqldb:mem:testdb-" + new Random().nextInt()).applyTo(this.context); + TestPropertyValues.of("spring.datasource.initialize:false", + "spring.datasource.url:jdbc:hsqldb:mem:testdb-" + new Random().nextInt()) + .applyTo(this.context); } @After diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java index c48f8958cf..100243e3c6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,8 +88,7 @@ public class JndiDataSourceAutoConfigurationTests { configureJndi("foo", dataSource); this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.datasource.jndi-name:foo").applyTo(this.context); + TestPropertyValues.of("spring.datasource.jndi-name:foo").applyTo(this.context); this.context.register(JndiDataSourceAutoConfiguration.class); this.context.refresh(); @@ -104,8 +103,7 @@ public class JndiDataSourceAutoConfigurationTests { configureJndi("foo", dataSource); this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.datasource.jndi-name:foo").applyTo(this.context); + TestPropertyValues.of("spring.datasource.jndi-name:foo").applyTo(this.context); this.context.register(JndiDataSourceAutoConfiguration.class, MBeanExporterConfiguration.class); this.context.refresh(); @@ -125,8 +123,7 @@ public class JndiDataSourceAutoConfigurationTests { configureJndi("foo", dataSource); this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.datasource.jndi-name:foo").applyTo(this.context); + TestPropertyValues.of("spring.datasource.jndi-name:foo").applyTo(this.context); this.context.register(JndiDataSourceAutoConfiguration.class, MBeanExporterConfiguration.class); this.context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java index c656954ad1..3339ebe92e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,8 +64,7 @@ public class TomcatDataSourceConfigurationTests { @Test public void testDataSourceExists() throws Exception { this.context.register(TomcatDataSourceConfiguration.class); - TestPropertyValues.of( - PREFIX + "url:jdbc:h2:mem:testdb").applyTo(this.context); + TestPropertyValues.of(PREFIX + "url:jdbc:h2:mem:testdb").applyTo(this.context); this.context.refresh(); assertThat(this.context.getBean(DataSource.class)).isNotNull(); assertThat(this.context.getBean(org.apache.tomcat.jdbc.pool.DataSource.class)) @@ -75,14 +74,11 @@ public class TomcatDataSourceConfigurationTests { @Test public void testDataSourcePropertiesOverridden() throws Exception { this.context.register(TomcatDataSourceConfiguration.class); - TestPropertyValues.of( - PREFIX + "url:jdbc:h2:mem:testdb", - PREFIX + "testWhileIdle:true", - PREFIX + "testOnBorrow:true", + TestPropertyValues.of(PREFIX + "url:jdbc:h2:mem:testdb", + PREFIX + "testWhileIdle:true", PREFIX + "testOnBorrow:true", PREFIX + "testOnReturn:true", PREFIX + "timeBetweenEvictionRunsMillis:10000", - PREFIX + "minEvictableIdleTimeMillis:12345", - PREFIX + "maxWait:1234", + PREFIX + "minEvictableIdleTimeMillis:12345", PREFIX + "maxWait:1234", PREFIX + "jdbcInterceptors:SlowQueryReport", PREFIX + "validationInterval:9999").applyTo(this.context); this.context.refresh(); @@ -114,8 +110,7 @@ public class TomcatDataSourceConfigurationTests { @Test public void testDataSourceDefaultsPreserved() throws Exception { this.context.register(TomcatDataSourceConfiguration.class); - TestPropertyValues.of( - PREFIX + "url:jdbc:h2:mem:testdb").applyTo(this.context); + TestPropertyValues.of(PREFIX + "url:jdbc:h2:mem:testdb").applyTo(this.context); this.context.refresh(); org.apache.tomcat.jdbc.pool.DataSource ds = this.context .getBean(org.apache.tomcat.jdbc.pool.DataSource.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java index 823cdcf392..ba40da1e50 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java @@ -147,7 +147,8 @@ public class JooqAutoConfigurationTests { @Test public void relaxedBindingOfSqlDialect() { - load(new Class[] { JooqDataSourceConfiguration.class }, "spring.jooq.sql-dialect:PoSTGrES"); + load(new Class[] { JooqDataSourceConfiguration.class }, + "spring.jooq.sql-dialect:PoSTGrES"); assertThat(this.context.getBean(org.jooq.Configuration.class).dialect()) .isEqualTo(SQLDialect.POSTGRES); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslatorTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslatorTests.java index 35bb938cb0..67217b0587 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslatorTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslatorTests.java @@ -59,7 +59,7 @@ public class JooqExceptionTranslatorTests { new Object[] { SQLDialect.POSTGRES_9_3, sqlException("03000") }, new Object[] { SQLDialect.POSTGRES_9_4, sqlException("03000") }, new Object[] { SQLDialect.POSTGRES_9_5, sqlException("03000") }, - new Object[] { SQLDialect.SQLITE, sqlException("21000") }}; + new Object[] { SQLDialect.SQLITE, sqlException("21000") } }; } private static SQLException sqlException(String sqlState) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/SqlDialectLookupTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/SqlDialectLookupTests.java index dd3f4e7aa8..70d1a17f40 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/SqlDialectLookupTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/SqlDialectLookupTests.java @@ -42,7 +42,8 @@ public class SqlDialectLookupTests { } @Test - public void getSqlDialectWhenDataSourceIsUnknownShouldReturnDefault() throws Exception { + public void getSqlDialectWhenDataSourceIsUnknownShouldReturnDefault() + throws Exception { testGetSqlDialect("jdbc:idontexist:", SQLDialect.DEFAULT); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfigurationTests.java index a6c7c665a2..124e27e4ad 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfigurationTests.java @@ -78,8 +78,8 @@ public class EmbeddedLdapAutoConfigurationTests { @Test public void testRandomPortWithValueAnnotation() throws LDAPException { - TestPropertyValues.of( - "spring.ldap.embedded.base-dn:dc=spring,dc=org").applyTo(this.context); + TestPropertyValues.of("spring.ldap.embedded.base-dn:dc=spring,dc=org") + .applyTo(this.context); this.context.register(EmbeddedLdapAutoConfiguration.class, LdapClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -119,8 +119,8 @@ public class EmbeddedLdapAutoConfigurationTests { @Test public void testQueryEmbeddedLdap() throws LDAPException { - TestPropertyValues.of( - "spring.ldap.embedded.base-dn:dc=spring,dc=org").applyTo(this.context); + TestPropertyValues.of("spring.ldap.embedded.base-dn:dc=spring,dc=org") + .applyTo(this.context); this.context.register(EmbeddedLdapAutoConfiguration.class, LdapAutoConfiguration.class, LdapDataAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java index 81cebc9662..6d07befc90 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java @@ -69,8 +69,8 @@ public class LiquibaseAutoConfigurationTests { @Before public void init() { - TestPropertyValues.of( - "spring.datasource.name:liquibasetest").applyTo(this.context); + TestPropertyValues.of("spring.datasource.name:liquibasetest") + .applyTo(this.context); new LiquibaseServiceLocatorApplicationListener().onApplicationEvent(null); } @@ -106,8 +106,9 @@ public class LiquibaseAutoConfigurationTests { @Test public void testXmlChangeLog() throws Exception { - TestPropertyValues.of( - "liquibase.change-log:classpath:/db/changelog/db.changelog-override.xml").applyTo(this.context); + TestPropertyValues + .of("liquibase.change-log:classpath:/db/changelog/db.changelog-override.xml") + .applyTo(this.context); this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -119,8 +120,9 @@ public class LiquibaseAutoConfigurationTests { @Test public void testJsonChangeLog() throws Exception { - TestPropertyValues.of( - "liquibase.change-log:classpath:/db/changelog/db.changelog-override.json").applyTo(this.context); + TestPropertyValues + .of("liquibase.change-log:classpath:/db/changelog/db.changelog-override.json") + .applyTo(this.context); this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -132,8 +134,9 @@ public class LiquibaseAutoConfigurationTests { @Test public void testSqlChangeLog() throws Exception { - TestPropertyValues.of( - "liquibase.change-log:classpath:/db/changelog/db.changelog-override.sql").applyTo(this.context); + TestPropertyValues + .of("liquibase.change-log:classpath:/db/changelog/db.changelog-override.sql") + .applyTo(this.context); this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -145,8 +148,8 @@ public class LiquibaseAutoConfigurationTests { @Test public void testOverrideContexts() throws Exception { - TestPropertyValues.of( - "liquibase.contexts:test, production").applyTo(this.context); + TestPropertyValues.of("liquibase.contexts:test, production") + .applyTo(this.context); this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -157,8 +160,7 @@ public class LiquibaseAutoConfigurationTests { @Test public void testOverrideDefaultSchema() throws Exception { - TestPropertyValues.of( - "liquibase.default-schema:public").applyTo(this.context); + TestPropertyValues.of("liquibase.default-schema:public").applyTo(this.context); this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -180,8 +182,9 @@ public class LiquibaseAutoConfigurationTests { @Test public void testOverrideDataSource() throws Exception { - TestPropertyValues.of( - "liquibase.url:jdbc:hsqldb:mem:liquibase", "liquibase.user:sa").applyTo(this.context); + TestPropertyValues + .of("liquibase.url:jdbc:hsqldb:mem:liquibase", "liquibase.user:sa") + .applyTo(this.context); this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -195,8 +198,8 @@ public class LiquibaseAutoConfigurationTests { @Test(expected = BeanCreationException.class) public void testChangeLogDoesNotExist() throws Exception { - TestPropertyValues.of( - "liquibase.change-log:classpath:/no-such-changelog.yaml").applyTo(this.context); + TestPropertyValues.of("liquibase.change-log:classpath:/no-such-changelog.yaml") + .applyTo(this.context); this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -217,8 +220,7 @@ public class LiquibaseAutoConfigurationTests { @Test public void testOverrideLabels() throws Exception { - TestPropertyValues.of( - "liquibase.labels:test, production").applyTo(this.context); + TestPropertyValues.of("liquibase.labels:test, production").applyTo(this.context); this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -245,8 +247,8 @@ public class LiquibaseAutoConfigurationTests { @Test public void testRollbackFile() throws Exception { File file = this.temp.newFile("rollback-file.sql"); - TestPropertyValues.of( - "liquibase.rollbackFile:" + file.getAbsolutePath()).applyTo(this.context); + TestPropertyValues.of("liquibase.rollbackFile:" + file.getAbsolutePath()) + .applyTo(this.context); this.context.register(EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfigurationTests.java index b977eec880..bcb98957bb 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfigurationTests.java @@ -67,8 +67,7 @@ public class SitePreferenceAutoConfigurationTests { @Test public void sitePreferenceHandlerInterceptorEnabled() throws Exception { this.context = new AnnotationConfigWebApplicationContext(); - TestPropertyValues.of( - "spring.mobile.sitepreference.enabled:true"); + TestPropertyValues.of("spring.mobile.sitepreference.enabled:true"); this.context.register(SitePreferenceAutoConfiguration.class); this.context.refresh(); assertThat(this.context.getBean(SitePreferenceHandlerInterceptor.class)) @@ -78,8 +77,8 @@ public class SitePreferenceAutoConfigurationTests { @Test(expected = NoSuchBeanDefinitionException.class) public void sitePreferenceHandlerInterceptorDisabled() { this.context = new AnnotationConfigWebApplicationContext(); - TestPropertyValues.of( - "spring.mobile.sitepreference.enabled:false").applyTo(this.context); + TestPropertyValues.of("spring.mobile.sitepreference.enabled:false") + .applyTo(this.context); this.context.register(SitePreferenceAutoConfiguration.class); this.context.refresh(); this.context.getBean(SitePreferenceHandlerInterceptor.class); @@ -98,8 +97,7 @@ public class SitePreferenceAutoConfigurationTests { @Test public void sitePreferenceMethodArgumentResolverEnabled() throws Exception { this.context = new AnnotationConfigWebApplicationContext(); - TestPropertyValues.of( - "spring.mobile.sitepreference.enabled:true"); + TestPropertyValues.of("spring.mobile.sitepreference.enabled:true"); this.context.register(SitePreferenceAutoConfiguration.class); this.context.refresh(); assertThat( @@ -110,8 +108,8 @@ public class SitePreferenceAutoConfigurationTests { @Test(expected = NoSuchBeanDefinitionException.class) public void sitePreferenceMethodArgumentResolverDisabled() { this.context = new AnnotationConfigWebApplicationContext(); - TestPropertyValues.of( - "spring.mobile.sitepreference.enabled:false").applyTo(this.context); + TestPropertyValues.of("spring.mobile.sitepreference.enabled:false") + .applyTo(this.context); this.context.register(SitePreferenceAutoConfiguration.class); this.context.refresh(); this.context.getBean(SitePreferenceHandlerMethodArgumentResolver.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java index b9d0229475..ea4e43df09 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java @@ -60,8 +60,7 @@ public class MongoAutoConfigurationTests { @Test public void optionsAdded() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.mongodb.host:localhost"); + TestPropertyValues.of("spring.data.mongodb.host:localhost"); this.context.register(OptionsConfig.class, PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class); this.context.refresh(); @@ -72,8 +71,7 @@ public class MongoAutoConfigurationTests { @Test public void optionsAddedButNoHost() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.mongodb.uri:mongodb://localhost/test"); + TestPropertyValues.of("spring.data.mongodb.uri:mongodb://localhost/test"); this.context.register(OptionsConfig.class, PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class); this.context.refresh(); @@ -84,8 +82,8 @@ public class MongoAutoConfigurationTests { @Test public void optionsSslConfig() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.mongodb.uri:mongodb://localhost/test").applyTo(this.context); + TestPropertyValues.of("spring.data.mongodb.uri:mongodb://localhost/test") + .applyTo(this.context); this.context.register(SslOptionsConfig.class, PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class); this.context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoReactiveAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoReactiveAutoConfigurationTests.java index 7196eb92bf..80ada0814d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoReactiveAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoReactiveAutoConfigurationTests.java @@ -66,8 +66,7 @@ public class MongoReactiveAutoConfigurationTests { @Test public void optionsAdded() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.mongodb.host:localhost").applyTo(this.context); + TestPropertyValues.of("spring.data.mongodb.host:localhost").applyTo(this.context); this.context.register(OptionsConfig.class, PropertyPlaceholderAutoConfiguration.class, MongoReactiveAutoConfiguration.class); @@ -79,8 +78,7 @@ public class MongoReactiveAutoConfigurationTests { @Test public void optionsAddedButNoHost() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.mongodb.uri:mongodb://localhost/test"); + TestPropertyValues.of("spring.data.mongodb.uri:mongodb://localhost/test"); this.context.register(OptionsConfig.class, PropertyPlaceholderAutoConfiguration.class, MongoReactiveAutoConfiguration.class); @@ -93,8 +91,8 @@ public class MongoReactiveAutoConfigurationTests { @Test public void optionsSslConfig() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.data.mongodb.uri:mongodb://localhost/test").applyTo(this.context); + TestPropertyValues.of("spring.data.mongodb.uri:mongodb://localhost/test") + .applyTo(this.context); this.context.register(SslOptionsConfig.class, PropertyPlaceholderAutoConfiguration.class, MongoReactiveAutoConfiguration.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java index 4db58375ac..810d44e663 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java @@ -158,11 +158,11 @@ public class EmbeddedMongoAutoConfigurationTests { String expectedVersion) { this.context = new AnnotationConfigApplicationContext(); int mongoPort = SocketUtils.findAvailableTcpPort(); - TestPropertyValues.of( - "spring.data.mongodb.port=" + mongoPort).applyTo(this.context); + TestPropertyValues.of("spring.data.mongodb.port=" + mongoPort) + .applyTo(this.context); if (configuredVersion != null) { - TestPropertyValues.of( - "spring.mongodb.embedded.version=" + configuredVersion).applyTo(this.context); + TestPropertyValues.of("spring.mongodb.embedded.version=" + configuredVersion) + .applyTo(this.context); } this.context.register(MongoAutoConfiguration.class, MongoDataAutoConfiguration.class, EmbeddedMongoAutoConfiguration.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationTests.java index a476d36488..d56cde04bf 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationTests.java @@ -44,47 +44,56 @@ public class MustacheAutoConfigurationTests { public void registerBeansForServletApp() { loadWithServlet(null); assertThat(this.webContext.getBeansOfType(Mustache.Compiler.class)).hasSize(1); - assertThat(this.webContext.getBeansOfType(MustacheResourceTemplateLoader.class)).hasSize(1); + assertThat(this.webContext.getBeansOfType(MustacheResourceTemplateLoader.class)) + .hasSize(1); assertThat(this.webContext.getBeansOfType(MustacheViewResolver.class)).hasSize(1); } @Test public void registerCompilerForServletApp() { loadWithServlet(CustomCompilerConfiguration.class); - assertThat(this.webContext.getBeansOfType(MustacheResourceTemplateLoader.class)).hasSize(1); + assertThat(this.webContext.getBeansOfType(MustacheResourceTemplateLoader.class)) + .hasSize(1); assertThat(this.webContext.getBeansOfType(MustacheViewResolver.class)).hasSize(1); assertThat(this.webContext.getBeansOfType(Mustache.Compiler.class)).hasSize(1); - assertThat(this.webContext.getBean(Mustache.Compiler.class).standardsMode).isTrue(); + assertThat(this.webContext.getBean(Mustache.Compiler.class).standardsMode) + .isTrue(); } @Test public void registerBeansForReactiveApp() { loadWithReactive(null); - assertThat(this.reactiveWebContext.getBeansOfType(Mustache.Compiler.class)).hasSize(1); - assertThat(this.reactiveWebContext.getBeansOfType(MustacheResourceTemplateLoader.class)).hasSize(1); - assertThat(this.reactiveWebContext.getBeansOfType(MustacheViewResolver.class)).isEmpty(); + assertThat(this.reactiveWebContext.getBeansOfType(Mustache.Compiler.class)) + .hasSize(1); assertThat(this.reactiveWebContext - .getBeansOfType(org.springframework.boot.web.reactive.result.view.MustacheViewResolver.class) - ).hasSize(1); + .getBeansOfType(MustacheResourceTemplateLoader.class)).hasSize(1); + assertThat(this.reactiveWebContext.getBeansOfType(MustacheViewResolver.class)) + .isEmpty(); + assertThat(this.reactiveWebContext.getBeansOfType( + org.springframework.boot.web.reactive.result.view.MustacheViewResolver.class)) + .hasSize(1); } - @Test public void registerCompilerForReactiveApp() { loadWithReactive(CustomCompilerConfiguration.class); - assertThat(this.reactiveWebContext.getBeansOfType(Mustache.Compiler.class)).hasSize(1); - assertThat(this.reactiveWebContext.getBeansOfType(MustacheResourceTemplateLoader.class)).hasSize(1); - assertThat(this.reactiveWebContext.getBeansOfType(MustacheViewResolver.class)).isEmpty(); + assertThat(this.reactiveWebContext.getBeansOfType(Mustache.Compiler.class)) + .hasSize(1); assertThat(this.reactiveWebContext - .getBeansOfType(org.springframework.boot.web.reactive.result.view.MustacheViewResolver.class) - ).hasSize(1); - assertThat(this.reactiveWebContext.getBean(Mustache.Compiler.class).standardsMode).isTrue(); + .getBeansOfType(MustacheResourceTemplateLoader.class)).hasSize(1); + assertThat(this.reactiveWebContext.getBeansOfType(MustacheViewResolver.class)) + .isEmpty(); + assertThat(this.reactiveWebContext.getBeansOfType( + org.springframework.boot.web.reactive.result.view.MustacheViewResolver.class)) + .hasSize(1); + assertThat(this.reactiveWebContext.getBean(Mustache.Compiler.class).standardsMode) + .isTrue(); } private void loadWithServlet(Class config) { this.webContext = new AnnotationConfigWebApplicationContext(); - TestPropertyValues.of( - "spring.mustache.prefix=classpath:/mustache-templates/").applyTo(this.webContext); + TestPropertyValues.of("spring.mustache.prefix=classpath:/mustache-templates/") + .applyTo(this.webContext); if (config != null) { this.webContext.register(config); } @@ -94,8 +103,8 @@ public class MustacheAutoConfigurationTests { private void loadWithReactive(Class config) { this.reactiveWebContext = new GenericReactiveWebApplicationContext(); - TestPropertyValues.of( - "spring.mustache.prefix=classpath:/mustache-templates/").applyTo(this.reactiveWebContext); + TestPropertyValues.of("spring.mustache.prefix=classpath:/mustache-templates/") + .applyTo(this.reactiveWebContext); if (config != null) { this.reactiveWebContext.register(config); } @@ -104,7 +113,7 @@ public class MustacheAutoConfigurationTests { } @Configuration - @Import({MustacheAutoConfiguration.class}) + @Import({ MustacheAutoConfiguration.class }) protected static class BaseConfiguration { } @@ -113,8 +122,10 @@ public class MustacheAutoConfigurationTests { protected static class CustomCompilerConfiguration { @Bean - public Mustache.Compiler compiler(Mustache.TemplateLoader mustacheTemplateLoader) { - return Mustache.compiler().standardsMode(true).withLoader(mustacheTemplateLoader); + public Mustache.Compiler compiler( + Mustache.TemplateLoader mustacheTemplateLoader) { + return Mustache.compiler().standardsMode(true) + .withLoader(mustacheTemplateLoader); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java index 5a6fa19b34..97fc110849 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java @@ -140,8 +140,8 @@ public abstract class AbstractJpaAutoConfigurationTests { @Test public void customJpaProperties() throws Exception { - TestPropertyValues.of("spring.jpa.properties.a:b", - "spring.jpa.properties.a.b:c", "spring.jpa.properties.c:d").applyTo(this.context); + TestPropertyValues.of("spring.jpa.properties.a:b", "spring.jpa.properties.a.b:c", + "spring.jpa.properties.c:d").applyTo(this.context); setupTestConfiguration(); this.context.refresh(); LocalContainerEntityManagerFactoryBean bean = this.context @@ -154,8 +154,7 @@ public abstract class AbstractJpaAutoConfigurationTests { @Test public void usesManuallyDefinedLocalContainerEntityManagerFactoryBeanIfAvailable() { - TestPropertyValues.of( - "spring.datasource.initialize:false"); + TestPropertyValues.of("spring.datasource.initialize:false"); setupTestConfiguration( TestConfigurationWithLocalContainerEntityManagerFactoryBean.class); this.context.refresh(); @@ -167,8 +166,7 @@ public abstract class AbstractJpaAutoConfigurationTests { @Test public void usesManuallyDefinedEntityManagerFactoryIfAvailable() { - TestPropertyValues.of( - "spring.datasource.initialize:false").applyTo(this.context); + TestPropertyValues.of("spring.datasource.initialize:false").applyTo(this.context); setupTestConfiguration(TestConfigurationWithEntityManagerFactory.class); this.context.refresh(); EntityManagerFactory factoryBean = this.context diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java index 2752814cb0..f911370d0a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java @@ -63,11 +63,13 @@ public class CustomHibernateJpaAutoConfigurationTests { public void testDefaultDdlAutoForMySql() throws Exception { // Set up environment so we get a MySQL database but don't require server to be // running... - TestPropertyValues.of( - "spring.datasource.type:" + org.apache.tomcat.jdbc.pool.DataSource.class.getName(), + TestPropertyValues + .of("spring.datasource.type:" + + org.apache.tomcat.jdbc.pool.DataSource.class.getName(), "spring.datasource.database:mysql", "spring.datasource.url:jdbc:mysql://localhost/nonexistent", - "spring.datasource.initialize:false", "spring.jpa.database:MYSQL").applyTo(this.context); + "spring.datasource.initialize:false", "spring.jpa.database:MYSQL") + .applyTo(this.context); this.context.register(TestConfiguration.class, DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, HibernateJpaAutoConfiguration.class); @@ -82,8 +84,7 @@ public class CustomHibernateJpaAutoConfigurationTests { @Test public void testDefaultDdlAutoForEmbedded() throws Exception { - TestPropertyValues.of( - "spring.datasource.initialize:false"); + TestPropertyValues.of("spring.datasource.initialize:false"); this.context.register(TestConfiguration.class, EmbeddedDataSourceConfiguration.class, PropertyPlaceholderAutoConfiguration.class, @@ -98,8 +99,8 @@ public class CustomHibernateJpaAutoConfigurationTests { @Test public void testNamingStrategyDelegatorTakesPrecedence() { - TestPropertyValues.of( - "spring.jpa.properties.hibernate.ejb.naming_strategy_delegator:" + TestPropertyValues + .of("spring.jpa.properties.hibernate.ejb.naming_strategy_delegator:" + "org.hibernate.cfg.naming.ImprovedNamingStrategyDelegator"); this.context.register(TestConfiguration.class, EmbeddedDataSourceConfiguration.class, @@ -114,8 +115,7 @@ public class CustomHibernateJpaAutoConfigurationTests { @Test public void testDefaultDatabaseForH2() throws Exception { - TestPropertyValues.of( - "spring.datasource.url:jdbc:h2:mem:testdb", + TestPropertyValues.of("spring.datasource.url:jdbc:h2:mem:testdb", "spring.datasource.initialize:false").applyTo(this.context); this.context.register(TestConfiguration.class, DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java index 56c98539fd..fa82073f35 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,10 +64,11 @@ public class HibernateJpaAutoConfigurationTests @Test public void testDataScriptWithMissingDdl() throws Exception { - TestPropertyValues.of( - "spring.datasource.data:classpath:/city.sql", - // Missing: - "spring.datasource.schema:classpath:/ddl.sql").applyTo(this.context); + TestPropertyValues + .of("spring.datasource.data:classpath:/city.sql", + // Missing: + "spring.datasource.schema:classpath:/ddl.sql") + .applyTo(this.context); setupTestConfiguration(); this.thrown.expectMessage("ddl.sql"); this.thrown.expectMessage("spring.datasource.schema"); @@ -79,8 +80,8 @@ public class HibernateJpaAutoConfigurationTests // and Hibernate hasn't initialized yet at that point @Test(expected = BeanCreationException.class) public void testDataScript() throws Exception { - TestPropertyValues.of( - "spring.datasource.data:classpath:/city.sql").applyTo(this.context); + TestPropertyValues.of("spring.datasource.data:classpath:/city.sql") + .applyTo(this.context); setupTestConfiguration(); this.context.refresh(); assertThat(new JdbcTemplate(this.context.getBean(DataSource.class)) @@ -89,8 +90,7 @@ public class HibernateJpaAutoConfigurationTests @Test public void testFlywayPlusValidation() throws Exception { - TestPropertyValues.of( - "spring.datasource.initialize:false", + TestPropertyValues.of("spring.datasource.initialize:false", "flyway.locations:classpath:db/city", "spring.jpa.hibernate.ddl-auto:validate").applyTo(this.context); setupTestConfiguration(); @@ -100,8 +100,7 @@ public class HibernateJpaAutoConfigurationTests @Test public void testLiquibasePlusValidation() throws Exception { - TestPropertyValues.of( - "spring.datasource.initialize:false", + TestPropertyValues.of("spring.datasource.initialize:false", "liquibase.changeLog:classpath:db/changelog/db.changelog-city.yaml", "spring.jpa.hibernate.ddl-auto:validate").applyTo(this.context); setupTestConfiguration(); @@ -123,9 +122,8 @@ public class HibernateJpaAutoConfigurationTests @Test public void testCustomJtaPlatform() throws Exception { - TestPropertyValues.of( - "spring.jpa.properties.hibernate.transaction.jta.platform:" - + TestJtaPlatform.class.getName()).applyTo(this.context); + TestPropertyValues.of("spring.jpa.properties.hibernate.transaction.jta.platform:" + + TestJtaPlatform.class.getName()).applyTo(this.context); this.context.register(JtaAutoConfiguration.class); setupTestConfiguration(); this.context.refresh(); @@ -138,9 +136,10 @@ public class HibernateJpaAutoConfigurationTests @Test public void testCustomJpaTransactionManagerUsingProperties() throws Exception { - TestPropertyValues.of( - "spring.transaction.default-timeout:30", - "spring.transaction.rollback-on-commit-failure:true").applyTo(this.context); + TestPropertyValues + .of("spring.transaction.default-timeout:30", + "spring.transaction.rollback-on-commit-failure:true") + .applyTo(this.context); setupTestConfiguration(); this.context.refresh(); JpaTransactionManager transactionManager = this.context diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java index bbfe90ba70..06665d1e15 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java @@ -105,8 +105,8 @@ public class QuartzAutoConfigurationTests { @Test public void withDataSource() throws Exception { load(new Class[] { QuartzJobsConfiguration.class, - EmbeddedDataSourceConfiguration.class, - DataSourceTransactionManagerAutoConfiguration.class }, + EmbeddedDataSourceConfiguration.class, + DataSourceTransactionManagerAutoConfiguration.class }, "spring.quartz.job-store-type=jdbc", "spring.quartz.jdbc.initialize-schema=true"); testWithDataSource(); @@ -115,7 +115,7 @@ public class QuartzAutoConfigurationTests { @Test public void withDataSourceNoTransactionManager() throws Exception { load(new Class[] { QuartzJobsConfiguration.class, - EmbeddedDataSourceConfiguration.class }, + EmbeddedDataSourceConfiguration.class }, "spring.quartz.job-store-type=jdbc", "spring.quartz.jdbc.initialize-schema=true"); testWithDataSource(); @@ -130,8 +130,8 @@ public class QuartzAutoConfigurationTests { this.context.getBean(DataSource.class)); assertThat(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM QRTZ_JOB_DETAILS", Integer.class)).isEqualTo(2); - assertThat(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM QRTZ_SIMPLE_TRIGGERS", - Integer.class)).isEqualTo(0); + assertThat(jdbcTemplate.queryForObject( + "SELECT COUNT(*) FROM QRTZ_SIMPLE_TRIGGERS", Integer.class)).isEqualTo(0); } @Test @@ -222,8 +222,7 @@ public class QuartzAutoConfigurationTests { @Bean public JobDetail fooJob() { return JobBuilder.newJob().ofType(FooJob.class).withIdentity("fooJob") - .usingJobData("jobDataKey", "jobDataValue") - .storeDurably().build(); + .usingJobData("jobDataKey", "jobDataValue").storeDurably().build(); } @Bean diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java index eb97c64099..fd27e1d16c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java @@ -113,7 +113,8 @@ public class SecurityAutoConfigurationTests { SecurityFilterAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); customContext.refresh(); - assertThat(customContext.containsBean("securityFilterChainRegistration")).isFalse(); + assertThat(customContext.containsBean("securityFilterChainRegistration")) + .isFalse(); } } @@ -277,10 +278,8 @@ public class SecurityAutoConfigurationTests { public void testJpaCoexistsHappily() throws Exception { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); - TestPropertyValues.of( - "spring.datasource.url:jdbc:hsqldb:mem:testsecdb"); - TestPropertyValues.of( - "spring.datasource.initialize:false"); + TestPropertyValues.of("spring.datasource.url:jdbc:hsqldb:mem:testsecdb"); + TestPropertyValues.of("spring.datasource.initialize:false"); this.context.register(EntityConfiguration.class, PropertyPlaceholderAutoConfiguration.class, DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, @@ -370,8 +369,8 @@ public class SecurityAutoConfigurationTests { this.context.register(SecurityAutoConfiguration.class, SecurityFilterAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); - TestPropertyValues.of( - "security.filter-dispatcher-types:INCLUDE,ERROR").applyTo(this.context); + TestPropertyValues.of("security.filter-dispatcher-types:INCLUDE,ERROR") + .applyTo(this.context); this.context.refresh(); DelegatingFilterProxyRegistrationBean bean = this.context.getBean( "securityFilterChainRegistration", diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java index 8c24843471..0143bba486 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java @@ -59,8 +59,8 @@ public class SecurityFilterAutoConfigurationEarlyInitializationTests { @Test public void testSecurityFilterDoesNotCauseEarlyInitialization() throws Exception { try (AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext()) { - TestPropertyValues.of("server.port:0", - "security.user.password:password").applyTo(context); + TestPropertyValues.of("server.port:0", "security.user.password:password") + .applyTo(context); context.register(Config.class); context.refresh(); int port = context.getWebServer().getPort(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java index b21ad1a6f6..723b8a86f4 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java @@ -183,12 +183,13 @@ public class OAuth2AutoConfigurationTests { @Test public void testEnvironmentalOverrides() { this.context = new AnnotationConfigServletWebServerApplicationContext(); - TestPropertyValues.of( - "security.oauth2.client.clientId:myclientid", - "security.oauth2.client.clientSecret:mysecret", - "security.oauth2.client.autoApproveScopes:read,write", - "security.oauth2.client.accessTokenValiditySeconds:40", - "security.oauth2.client.refreshTokenValiditySeconds:80").applyTo(this.context); + TestPropertyValues + .of("security.oauth2.client.clientId:myclientid", + "security.oauth2.client.clientSecret:mysecret", + "security.oauth2.client.autoApproveScopes:read,write", + "security.oauth2.client.accessTokenValiditySeconds:40", + "security.oauth2.client.refreshTokenValiditySeconds:80") + .applyTo(this.context); this.context.register(AuthorizationAndResourceServerConfiguration.class, MinimalSecureWebApplication.class); this.context.refresh(); @@ -230,9 +231,10 @@ public class OAuth2AutoConfigurationTests { this.context = new AnnotationConfigServletWebServerApplicationContext(); this.context.register(TestSecurityConfiguration.class, MinimalSecureWebApplication.class); - TestPropertyValues.of( - "security.oauth2.client.clientId=client", - "security.oauth2.client.grantType=client_credentials").applyTo(this.context); + TestPropertyValues + .of("security.oauth2.client.clientId=client", + "security.oauth2.client.grantType=client_credentials") + .applyTo(this.context); ConfigurationPropertySources.attach(this.context.getEnvironment()); this.context.refresh(); OAuth2ClientContext bean = this.context.getBean(OAuth2ClientContext.class); @@ -246,9 +248,10 @@ public class OAuth2AutoConfigurationTests { this.context = new AnnotationConfigServletWebServerApplicationContext(); this.context.register(ClientConfiguration.class, MinimalSecureWebApplication.class); - TestPropertyValues.of( - "security.oauth2.client.clientId=client", - "security.oauth2.client.grantType=client_credentials").applyTo(this.context); + TestPropertyValues + .of("security.oauth2.client.clientId=client", + "security.oauth2.client.grantType=client_credentials") + .applyTo(this.context); ConfigurationPropertySources.attach(this.context.getEnvironment()); this.context.refresh(); // The primary context is fine (not session scoped): @@ -267,8 +270,7 @@ public class OAuth2AutoConfigurationTests { public void testClientIsNotAuthCode() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(MinimalSecureNonWebApplication.class); - TestPropertyValues.of( - "security.oauth2.client.clientId=client").applyTo(context); + TestPropertyValues.of("security.oauth2.client.clientId=client").applyTo(context); context.refresh(); assertThat(countBeans(context, ClientCredentialsResourceDetails.class)) .isEqualTo(1); @@ -280,8 +282,8 @@ public class OAuth2AutoConfigurationTests { this.context = new AnnotationConfigServletWebServerApplicationContext(); this.context.register(ResourceServerConfiguration.class, MinimalSecureWebApplication.class); - TestPropertyValues.of( - "security.oauth2.resource.jwt.keyValue:DEADBEEF").applyTo(this.context); + TestPropertyValues.of("security.oauth2.resource.jwt.keyValue:DEADBEEF") + .applyTo(this.context); ConfigurationPropertySources.attach(this.context.getEnvironment()); this.context.refresh(); assertThat(countBeans(RESOURCE_SERVER_CONFIG)).isEqualTo(1); @@ -306,8 +308,8 @@ public class OAuth2AutoConfigurationTests { @Test public void testAuthorizationServerOverride() { this.context = new AnnotationConfigServletWebServerApplicationContext(); - TestPropertyValues.of( - "security.oauth2.resourceId:resource-id").applyTo(this.context); + TestPropertyValues.of("security.oauth2.resourceId:resource-id") + .applyTo(this.context); this.context.register(AuthorizationAndResourceServerConfiguration.class, CustomAuthorizationServer.class, MinimalSecureWebApplication.class); this.context.refresh(); @@ -396,8 +398,9 @@ public class OAuth2AutoConfigurationTests { public void resourceServerConditionWhenJwkConfigurationPresentShouldMatch() throws Exception { this.context = new AnnotationConfigServletWebServerApplicationContext(); - TestPropertyValues.of( - "security.oauth2.resource.jwk.key-set-uri:http://my-auth-server/token_keys").applyTo(this.context); + TestPropertyValues + .of("security.oauth2.resource.jwk.key-set-uri:http://my-auth-server/token_keys") + .applyTo(this.context); this.context.register(ResourceServerConfiguration.class, MinimalSecureWebApplication.class); this.context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/MultipleResourceServerConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/MultipleResourceServerConfigurationTests.java index 209f164530..5c11bb1ce4 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/MultipleResourceServerConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/MultipleResourceServerConfigurationTests.java @@ -55,8 +55,7 @@ public class MultipleResourceServerConfigurationTests { public void orderIsUnchangedWhenThereAreMultipleResourceServerConfigurations() { this.context = new AnnotationConfigWebApplicationContext(); this.context.register(DoubleResourceConfiguration.class); - TestPropertyValues.of( - "security.oauth2.resource.tokenInfoUri:http://example.com", + TestPropertyValues.of("security.oauth2.resource.tokenInfoUri:http://example.com", "security.oauth2.client.clientId=acme").applyTo(this.context); this.context.refresh(); assertThat(this.context diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java index b569885cb5..a570c1ce1a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java @@ -99,8 +99,8 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void useRemoteTokenServices() { - TestPropertyValues.of( - "security.oauth2.resource.tokenInfoUri:http://example.com").applyTo(this.environment); + TestPropertyValues.of("security.oauth2.resource.tokenInfoUri:http://example.com") + .applyTo(this.environment); this.context = new SpringApplicationBuilder(ResourceConfiguration.class) .environment(this.environment).web(WebApplicationType.NONE).run(); RemoteTokenServices services = this.context.getBean(RemoteTokenServices.class); @@ -109,8 +109,8 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void switchToUserInfo() { - TestPropertyValues.of( - "security.oauth2.resource.userInfoUri:http://example.com").applyTo(this.environment); + TestPropertyValues.of("security.oauth2.resource.userInfoUri:http://example.com") + .applyTo(this.environment); this.context = new SpringApplicationBuilder(ResourceConfiguration.class) .environment(this.environment).web(WebApplicationType.NONE).run(); UserInfoTokenServices services = this.context @@ -120,8 +120,8 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void userInfoWithAuthorities() { - TestPropertyValues.of( - "security.oauth2.resource.userInfoUri:http://example.com").applyTo(this.environment); + TestPropertyValues.of("security.oauth2.resource.userInfoUri:http://example.com") + .applyTo(this.environment); this.context = new SpringApplicationBuilder(AuthoritiesConfiguration.class) .environment(this.environment).web(WebApplicationType.NONE).run(); UserInfoTokenServices services = this.context @@ -133,8 +133,8 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void userInfoWithPrincipal() { - TestPropertyValues.of( - "security.oauth2.resource.userInfoUri:http://example.com").applyTo(this.environment); + TestPropertyValues.of("security.oauth2.resource.userInfoUri:http://example.com") + .applyTo(this.environment); this.context = new SpringApplicationBuilder(PrincipalConfiguration.class) .environment(this.environment).web(WebApplicationType.NONE).run(); UserInfoTokenServices services = this.context @@ -146,8 +146,7 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void userInfoWithClient() { - TestPropertyValues.of( - "security.oauth2.client.client-id=acme", + TestPropertyValues.of("security.oauth2.client.client-id=acme", "security.oauth2.resource.userInfoUri:http://example.com", "server.port=-1", "debug=true").applyTo(this.environment); this.context = new SpringApplicationBuilder(ResourceNoClientConfiguration.class) @@ -159,10 +158,11 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void preferUserInfo() { - TestPropertyValues.of( - "security.oauth2.resource.userInfoUri:http://example.com", - "security.oauth2.resource.tokenInfoUri:http://example.com", - "security.oauth2.resource.preferTokenInfo:false").applyTo(this.environment); + TestPropertyValues + .of("security.oauth2.resource.userInfoUri:http://example.com", + "security.oauth2.resource.tokenInfoUri:http://example.com", + "security.oauth2.resource.preferTokenInfo:false") + .applyTo(this.environment); this.context = new SpringApplicationBuilder(ResourceConfiguration.class) .environment(this.environment).web(WebApplicationType.NONE).run(); UserInfoTokenServices services = this.context @@ -172,10 +172,11 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void userInfoWithCustomizer() { - TestPropertyValues.of( - "security.oauth2.resource.userInfoUri:http://example.com", - "security.oauth2.resource.tokenInfoUri:http://example.com", - "security.oauth2.resource.preferTokenInfo:false").applyTo(this.environment); + TestPropertyValues + .of("security.oauth2.resource.userInfoUri:http://example.com", + "security.oauth2.resource.tokenInfoUri:http://example.com", + "security.oauth2.resource.preferTokenInfo:false") + .applyTo(this.environment); this.context = new SpringApplicationBuilder(ResourceConfiguration.class, Customizer.class).environment(this.environment) .web(WebApplicationType.NONE).run(); @@ -186,8 +187,8 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void switchToJwt() { - TestPropertyValues.of( - "security.oauth2.resource.jwt.keyValue=FOOBAR").applyTo(this.environment); + TestPropertyValues.of("security.oauth2.resource.jwt.keyValue=FOOBAR") + .applyTo(this.environment); this.context = new SpringApplicationBuilder(ResourceConfiguration.class) .environment(this.environment).web(WebApplicationType.NONE).run(); DefaultTokenServices services = this.context.getBean(DefaultTokenServices.class); @@ -198,8 +199,8 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void asymmetricJwt() { - TestPropertyValues.of( - "security.oauth2.resource.jwt.keyValue=" + PUBLIC_KEY).applyTo(this.environment); + TestPropertyValues.of("security.oauth2.resource.jwt.keyValue=" + PUBLIC_KEY) + .applyTo(this.environment); this.context = new SpringApplicationBuilder(ResourceConfiguration.class) .environment(this.environment).web(WebApplicationType.NONE).run(); DefaultTokenServices services = this.context.getBean(DefaultTokenServices.class); @@ -208,8 +209,9 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void jwkConfiguration() throws Exception { - TestPropertyValues.of( - "security.oauth2.resource.jwk.key-set-uri=http://my-auth-server/token_keys").applyTo(this.environment); + TestPropertyValues + .of("security.oauth2.resource.jwk.key-set-uri=http://my-auth-server/token_keys") + .applyTo(this.environment); this.context = new SpringApplicationBuilder(ResourceConfiguration.class) .environment(this.environment).web(WebApplicationType.NONE).run(); DefaultTokenServices services = this.context.getBean(DefaultTokenServices.class); @@ -220,10 +222,11 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void springSocialUserInfo() { - TestPropertyValues.of( - "security.oauth2.resource.userInfoUri:http://example.com", - "spring.social.facebook.app-id=foo", - "spring.social.facebook.app-secret=bar").applyTo(this.environment); + TestPropertyValues + .of("security.oauth2.resource.userInfoUri:http://example.com", + "spring.social.facebook.app-id=foo", + "spring.social.facebook.app-secret=bar") + .applyTo(this.environment); this.context = new SpringApplicationBuilder(SocialResourceConfiguration.class) .environment(this.environment).web(WebApplicationType.SERVLET).run(); ConnectionFactoryLocator connectionFactory = this.context @@ -236,8 +239,8 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void customUserInfoRestTemplateFactory() { - TestPropertyValues.of( - "security.oauth2.resource.userInfoUri:http://example.com").applyTo(this.environment); + TestPropertyValues.of("security.oauth2.resource.userInfoUri:http://example.com") + .applyTo(this.environment); this.context = new SpringApplicationBuilder( CustomUserInfoRestTemplateFactory.class, ResourceConfiguration.class) .environment(this.environment).web(WebApplicationType.NONE).run(); @@ -249,8 +252,9 @@ public class ResourceServerTokenServicesConfigurationTests { @Test public void jwtAccessTokenConverterIsConfiguredWhenKeyUriIsProvided() { - TestPropertyValues.of( - "security.oauth2.resource.jwt.key-uri=http://localhost:12345/banana").applyTo(this.environment); + TestPropertyValues + .of("security.oauth2.resource.jwt.key-uri=http://localhost:12345/banana") + .applyTo(this.environment); this.context = new SpringApplicationBuilder(ResourceConfiguration.class, JwtAccessTokenConverterRestTemplateCustomizerConfiguration.class) .environment(this.environment).web(WebApplicationType.NONE).run(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/social/FacebookAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/social/FacebookAutoConfigurationTests.java index f3db73dd27..20a5aa2e2e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/social/FacebookAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/social/FacebookAutoConfigurationTests.java @@ -35,10 +35,9 @@ public class FacebookAutoConfigurationTests extends AbstractSocialAutoConfigurat @Test public void expectedSocialBeansCreated() throws Exception { this.context = new AnnotationConfigWebApplicationContext(); - TestPropertyValues.of( - "spring.social.facebook.appId:12345").applyTo(this.context); - TestPropertyValues.of( - "spring.social.facebook.appSecret:secret").applyTo(this.context); + TestPropertyValues.of("spring.social.facebook.appId:12345").applyTo(this.context); + TestPropertyValues.of("spring.social.facebook.appSecret:secret") + .applyTo(this.context); ConfigurationPropertySources.attach(this.context.getEnvironment()); this.context.register(FacebookAutoConfiguration.class); this.context.register(SocialWebAutoConfiguration.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/social/LinkedInAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/social/LinkedInAutoConfigurationTests.java index 433802a8e2..d325c9a195 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/social/LinkedInAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/social/LinkedInAutoConfigurationTests.java @@ -35,10 +35,9 @@ public class LinkedInAutoConfigurationTests extends AbstractSocialAutoConfigurat @Test public void expectedSocialBeansCreated() throws Exception { this.context = new AnnotationConfigWebApplicationContext(); - TestPropertyValues.of( - "spring.social.linkedin.appId:12345").applyTo(this.context); - TestPropertyValues.of( - "spring.social.linkedin.appSecret:secret").applyTo(this.context); + TestPropertyValues.of("spring.social.linkedin.appId:12345").applyTo(this.context); + TestPropertyValues.of("spring.social.linkedin.appSecret:secret") + .applyTo(this.context); ConfigurationPropertySources.attach(this.context.getEnvironment()); this.context.register(LinkedInAutoConfiguration.class); this.context.register(SocialWebAutoConfiguration.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/social/TwitterAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/social/TwitterAutoConfigurationTests.java index 5554989d84..8737325d9f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/social/TwitterAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/social/TwitterAutoConfigurationTests.java @@ -35,10 +35,9 @@ public class TwitterAutoConfigurationTests extends AbstractSocialAutoConfigurati @Test public void expectedSocialBeansCreated() throws Exception { this.context = new AnnotationConfigWebApplicationContext(); - TestPropertyValues.of( - "spring.social.twitter.appId:12345").applyTo(this.context); - TestPropertyValues.of( - "spring.social.twitter.appSecret:secret").applyTo(this.context); + TestPropertyValues.of("spring.social.twitter.appId:12345").applyTo(this.context); + TestPropertyValues.of("spring.social.twitter.appSecret:secret") + .applyTo(this.context); ConfigurationPropertySources.attach(this.context.getEnvironment()); this.context.register(TwitterAutoConfiguration.class); this.context.register(SocialWebAutoConfiguration.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java index 17bd27441a..5f7e8109f2 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java @@ -148,7 +148,8 @@ public class JtaAutoConfigurationTests { @Test public void customBitronixServerId() throws UnknownHostException { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of("spring.jta.transactionManagerId:custom").applyTo(this.context); + TestPropertyValues.of("spring.jta.transactionManagerId:custom") + .applyTo(this.context); this.context.register(JtaPropertiesConfiguration.class, BitronixJtaConfiguration.class); this.context.refresh(); @@ -160,7 +161,8 @@ public class JtaAutoConfigurationTests { @Test public void defaultAtomikosTransactionManagerName() throws UnknownHostException { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of("spring.jta.logDir:target/transaction-logs").applyTo(this.context); + TestPropertyValues.of("spring.jta.logDir:target/transaction-logs") + .applyTo(this.context); this.context.register(JtaPropertiesConfiguration.class, AtomikosJtaConfiguration.class); this.context.refresh(); @@ -172,9 +174,10 @@ public class JtaAutoConfigurationTests { @Test public void atomikosConnectionFactoryPoolConfiguration() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.jta.atomikos.connectionfactory.minPoolSize:5", - "spring.jta.atomikos.connectionfactory.maxPoolSize:10").applyTo(this.context); + TestPropertyValues + .of("spring.jta.atomikos.connectionfactory.minPoolSize:5", + "spring.jta.atomikos.connectionfactory.maxPoolSize:10") + .applyTo(this.context); this.context.register(JtaPropertiesConfiguration.class, AtomikosJtaConfiguration.class, PoolConfiguration.class); this.context.refresh(); @@ -187,9 +190,10 @@ public class JtaAutoConfigurationTests { @Test public void bitronixConnectionFactoryPoolConfiguration() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.jta.bitronix.connectionfactory.minPoolSize:5", - "spring.jta.bitronix.connectionfactory.maxPoolSize:10").applyTo(this.context); + TestPropertyValues + .of("spring.jta.bitronix.connectionfactory.minPoolSize:5", + "spring.jta.bitronix.connectionfactory.maxPoolSize:10") + .applyTo(this.context); this.context.register(JtaPropertiesConfiguration.class, BitronixJtaConfiguration.class, PoolConfiguration.class); this.context.refresh(); @@ -202,9 +206,10 @@ public class JtaAutoConfigurationTests { @Test public void atomikosDataSourcePoolConfiguration() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.jta.atomikos.datasource.minPoolSize:5", - "spring.jta.atomikos.datasource.maxPoolSize:10").applyTo(this.context); + TestPropertyValues + .of("spring.jta.atomikos.datasource.minPoolSize:5", + "spring.jta.atomikos.datasource.maxPoolSize:10") + .applyTo(this.context); this.context.register(JtaPropertiesConfiguration.class, AtomikosJtaConfiguration.class, PoolConfiguration.class); this.context.refresh(); @@ -217,9 +222,10 @@ public class JtaAutoConfigurationTests { @Test public void bitronixDataSourcePoolConfiguration() { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.jta.bitronix.datasource.minPoolSize:5", - "spring.jta.bitronix.datasource.maxPoolSize:10").applyTo(this.context); + TestPropertyValues + .of("spring.jta.bitronix.datasource.minPoolSize:5", + "spring.jta.bitronix.datasource.maxPoolSize:10") + .applyTo(this.context); this.context.register(JtaPropertiesConfiguration.class, BitronixJtaConfiguration.class, PoolConfiguration.class); this.context.refresh(); @@ -232,9 +238,10 @@ public class JtaAutoConfigurationTests { @Test public void atomikosCustomizeJtaTransactionManagerUsingProperties() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.transaction.default-timeout:30", - "spring.transaction.rollback-on-commit-failure:true").applyTo(this.context); + TestPropertyValues + .of("spring.transaction.default-timeout:30", + "spring.transaction.rollback-on-commit-failure:true") + .applyTo(this.context); this.context.register(AtomikosJtaConfiguration.class, TransactionAutoConfiguration.class); this.context.refresh(); @@ -247,9 +254,10 @@ public class JtaAutoConfigurationTests { @Test public void bitronixCustomizeJtaTransactionManagerUsingProperties() throws Exception { this.context = new AnnotationConfigApplicationContext(); - TestPropertyValues.of( - "spring.transaction.default-timeout:30", - "spring.transaction.rollback-on-commit-failure:true").applyTo(this.context); + TestPropertyValues + .of("spring.transaction.default-timeout:30", + "spring.transaction.rollback-on-commit-failure:true") + .applyTo(this.context); this.context.register(BitronixJtaConfiguration.class, TransactionAutoConfiguration.class); this.context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapterTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapterTests.java index 8d6f0858bc..ccd3c361f4 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapterTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapterTests.java @@ -31,7 +31,7 @@ import org.springframework.validation.MapBindingResult; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -54,8 +54,7 @@ public class ValidatorAdapterTests { @Test public void wrapLocalValidatorFactoryBean() { - ValidatorAdapter wrapper = load( - LocalValidatorFactoryBeanConfig.class); + ValidatorAdapter wrapper = load(LocalValidatorFactoryBeanConfig.class); assertThat(wrapper.supports(SampleData.class)).isTrue(); MapBindingResult errors = new MapBindingResult(new HashMap(), "test"); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java index d8598784d4..f7e56b2df1 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java @@ -174,8 +174,7 @@ public class DispatcherServletAutoConfigurationTests { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); this.context.register(DispatcherServletAutoConfiguration.class); - TestPropertyValues.of( - "spring.mvc.throw-exception-if-no-handler-found:true", + TestPropertyValues.of("spring.mvc.throw-exception-if-no-handler-found:true", "spring.mvc.dispatch-options-request:false", "spring.mvc.dispatch-trace-request:true", "spring.mvc.servlet.load-on-startup=5").applyTo(this.context); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/FilterOrderingIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/FilterOrderingIntegrationTests.java index 070f3dd65b..b7d665a813 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/FilterOrderingIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/FilterOrderingIntegrationTests.java @@ -85,8 +85,7 @@ public class FilterOrderingIntegrationTests { private void load() { this.context = new AnnotationConfigServletWebServerApplicationContext(); - TestPropertyValues.of( - "spring.session.store-type=hash-map").applyTo(this.context); + TestPropertyValues.of("spring.session.store-type=hash-map").applyTo(this.context); this.context.register(MockWebServerConfiguration.class, TestRedisConfiguration.class, WebMvcAutoConfiguration.class, SecurityAutoConfiguration.class, SessionAutoConfiguration.class, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfigurationTests.java index a0618ac719..19ddae4593 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfigurationTests.java @@ -171,8 +171,8 @@ public class MultipartAutoConfigurationTests { private void testWebServerWithCustomMultipartConfigEnabledSetting( final String propertyValue, int expectedNumberOfMultipartConfigElementBeans) { this.context = new AnnotationConfigServletWebServerApplicationContext(); - TestPropertyValues.of( - "spring.servlet.multipart.enabled=" + propertyValue).applyTo(this.context); + TestPropertyValues.of("spring.servlet.multipart.enabled=" + propertyValue) + .applyTo(this.context); this.context.register(WebServerWithNoMultipartTomcat.class, BaseConfiguration.class); this.context.refresh(); @@ -194,8 +194,8 @@ public class MultipartAutoConfigurationTests { @Test public void configureResolveLazily() { this.context = new AnnotationConfigServletWebServerApplicationContext(); - TestPropertyValues.of( - "spring.servlet.multipart.resolve-lazily=true").applyTo(this.context); + TestPropertyValues.of("spring.servlet.multipart.resolve-lazily=true") + .applyTo(this.context); this.context.register(WebServerWithNothing.class, BaseConfiguration.class); this.context.refresh(); StandardServletMultipartResolver multipartResolver = this.context diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfigurationTests.java index f69931bd3c..bcd983fc7f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfigurationTests.java @@ -122,9 +122,10 @@ public class ServletWebServerFactoryAutoConfigurationTests { @Test public void initParametersAreConfiguredOnTheServletContext() { this.context = new AnnotationConfigServletWebServerApplicationContext(); - TestPropertyValues.of( - "server.servlet.context-parameters.a:alpha", - "server.servlet.context-parameters.b:bravo").applyTo(this.context); + TestPropertyValues + .of("server.servlet.context-parameters.a:alpha", + "server.servlet.context-parameters.b:bravo") + .applyTo(this.context); this.context.register(BaseConfiguration.class); this.context.refresh(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java index 13a066dd7d..e6a8f2cf21 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java @@ -415,8 +415,8 @@ public class WebMvcAutoConfigurationTests { @Test public void overrideIgnoreDefaultModelOnRedirect() throws Exception { this.context = new AnnotationConfigServletWebServerApplicationContext(); - TestPropertyValues.of( - "spring.mvc.ignore-default-model-on-redirect:false").applyTo(this.context); + TestPropertyValues.of("spring.mvc.ignore-default-model-on-redirect:false") + .applyTo(this.context); this.context.register(Config.class, WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); @@ -675,7 +675,8 @@ public class WebMvcAutoConfigurationTests { .getBeanNamesForType(javax.validation.Validator.class); String[] springValidatorBeans = this.context.getBeanNamesForType(Validator.class); assertThat(jsrValidatorBeans).containsExactly("defaultValidator"); - assertThat(springValidatorBeans).containsExactly("defaultValidator", "mvcValidator"); + assertThat(springValidatorBeans).containsExactly("defaultValidator", + "mvcValidator"); Validator validator = this.context.getBean("mvcValidator", Validator.class); assertThat(validator).isInstanceOf(ValidatorAdapter.class); Object defaultValidator = this.context.getBean("defaultValidator"); @@ -698,7 +699,8 @@ public class WebMvcAutoConfigurationTests { @Test public void validatorWithConfigurerDoesNotExposeJsr303() { - load(MvcJsr303Validator.class, new Class[] { ValidationAutoConfiguration.class }); + load(MvcJsr303Validator.class, + new Class[] { ValidationAutoConfiguration.class }); assertThat(this.context.getBeansOfType(ValidatorFactory.class)).isEmpty(); assertThat(this.context.getBeansOfType(javax.validation.Validator.class)) .isEmpty(); @@ -717,7 +719,8 @@ public class WebMvcAutoConfigurationTests { assertThat(this.context.getBeansOfType(javax.validation.Validator.class)) .hasSize(1); String[] springValidatorBeans = this.context.getBeanNamesForType(Validator.class); - assertThat(springValidatorBeans).containsExactly("defaultValidator", "mvcValidator"); + assertThat(springValidatorBeans).containsExactly("defaultValidator", + "mvcValidator"); assertThat(this.context.getBean("mvcValidator")) .isSameAs(this.context.getBean(MvcValidator.class).validator); // Primary Spring validator is the auto-configured one as the MVC one has been @@ -733,13 +736,12 @@ public class WebMvcAutoConfigurationTests { .getBeanNamesForType(javax.validation.Validator.class); String[] springValidatorBeans = this.context.getBeanNamesForType(Validator.class); assertThat(jsrValidatorBeans).containsExactly("defaultValidator"); - assertThat(springValidatorBeans).containsExactly( - "customSpringValidator", "defaultValidator", "mvcValidator"); + assertThat(springValidatorBeans).containsExactly("customSpringValidator", + "defaultValidator", "mvcValidator"); Validator validator = this.context.getBean("mvcValidator", Validator.class); assertThat(validator).isInstanceOf(ValidatorAdapter.class); Object defaultValidator = this.context.getBean("defaultValidator"); - assertThat(((ValidatorAdapter) validator).getTarget()) - .isSameAs(defaultValidator); + assertThat(((ValidatorAdapter) validator).getTarget()).isSameAs(defaultValidator); // Primary Spring validator is the one used by MVC behind the scenes assertThat(this.context.getBean(Validator.class)).isEqualTo(defaultValidator); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java index e4f3da8be5..a144d1404d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java @@ -140,8 +140,9 @@ public class WebSocketMessagingAutoConfigurationTests { } private Object performStompSubscription(final String topic) throws Throwable { - TestPropertyValues.of("server.port:0", - "spring.jackson.serialization.indent-output:true").applyTo(this.context); + TestPropertyValues + .of("server.port:0", "spring.jackson.serialization.indent-output:true") + .applyTo(this.context); this.context.register(WebSocketMessagingConfiguration.class); new ServerPortInfoApplicationContextInitializer().initialize(this.context); this.context.refresh(); @@ -207,10 +208,10 @@ public class WebSocketMessagingAutoConfigurationTests { @EnableWebSocket @EnableConfigurationProperties @EnableWebSocketMessageBroker - @ImportAutoConfiguration({JacksonAutoConfiguration.class, + @ImportAutoConfiguration({ JacksonAutoConfiguration.class, ServletWebServerFactoryAutoConfiguration.class, WebSocketMessagingAutoConfiguration.class, - DispatcherServletAutoConfiguration.class}) + DispatcherServletAutoConfiguration.class }) static class WebSocketMessagingConfiguration extends AbstractWebSocketMessageBrokerConfigurer { diff --git a/spring-boot/src/main/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrar.java b/spring-boot/src/main/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrar.java index b725654511..98c04a0d70 100644 --- a/spring-boot/src/main/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrar.java +++ b/spring-boot/src/main/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrar.java @@ -47,9 +47,8 @@ import org.springframework.util.Assert; * @author Andy Wilkinson * @since 1.3.0 */ -public class SpringApplicationAdminMXBeanRegistrar - implements ApplicationContextAware, EnvironmentAware, InitializingBean, - DisposableBean { +public class SpringApplicationAdminMXBeanRegistrar implements ApplicationContextAware, + EnvironmentAware, InitializingBean, DisposableBean { private static final Log logger = LogFactory.getLog(SpringApplicationAdmin.class); diff --git a/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedSystemPropertySource.java b/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedSystemPropertySource.java index 24f9b52fba..fc7df8b9ef 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedSystemPropertySource.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedSystemPropertySource.java @@ -30,7 +30,8 @@ import org.springframework.core.env.SystemEnvironmentPropertySource; * @author Madhura Bhave * @since 2.0.0 */ -public class OriginTrackedSystemPropertySource extends SystemEnvironmentPropertySource implements OriginLookup { +public class OriginTrackedSystemPropertySource extends SystemEnvironmentPropertySource + implements OriginLookup { /** * Create a new {@code OriginTrackedSystemPropertySource} with the given name and @@ -60,4 +61,3 @@ public class OriginTrackedSystemPropertySource extends SystemEnvironmentProperty return null; } } - diff --git a/spring-boot/src/main/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessor.java index 00a776c27f..20dcf0c2be 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessor.java @@ -30,40 +30,47 @@ import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.SystemEnvironmentPropertySource; /** - * An {@link EnvironmentPostProcessor} that replaces the systemEnvironment {@link SystemEnvironmentPropertySource} - * with an {@link OriginTrackedSystemPropertySource} that can track the {@link SystemEnvironmentOrigin} for - * every system environment property. + * An {@link EnvironmentPostProcessor} that replaces the systemEnvironment + * {@link SystemEnvironmentPropertySource} with an + * {@link OriginTrackedSystemPropertySource} that can track the + * {@link SystemEnvironmentOrigin} for every system environment property. * * @author Madhura Bhave * @since 2.0.0 */ -public class SystemEnvironmentPropertySourceEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered { +public class SystemEnvironmentPropertySourceEnvironmentPostProcessor + implements EnvironmentPostProcessor, Ordered { /** * The default order for the processor. */ - public static final int DEFAULT_ORDER = SpringApplicationJsonEnvironmentPostProcessor.DEFAULT_ORDER - 1; + public static final int DEFAULT_ORDER = SpringApplicationJsonEnvironmentPostProcessor.DEFAULT_ORDER + - 1; private int order = DEFAULT_ORDER; @Override - public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { + public void postProcessEnvironment(ConfigurableEnvironment environment, + SpringApplication application) { String sourceName = StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME; - PropertySource propertySource = environment.getPropertySources().get(sourceName); + PropertySource propertySource = environment.getPropertySources() + .get(sourceName); if (propertySource != null) { replacePropertySource(environment, sourceName, propertySource); } } @SuppressWarnings("unchecked") - private void replacePropertySource(ConfigurableEnvironment environment, String sourceName, PropertySource propertySource) { + private void replacePropertySource(ConfigurableEnvironment environment, + String sourceName, PropertySource propertySource) { if (propertySource.getSource() instanceof Map) { - Map originalSource = (Map) propertySource.getSource(); + Map originalSource = (Map) propertySource + .getSource(); Map originTrackedSource = new LinkedHashMap<>(originalSource); - originTrackedSource.entrySet().forEach(e -> e.setValue(OriginTrackedValue.of(e.getValue(), - new SystemEnvironmentOrigin(e.getKey())))); - OriginTrackedSystemPropertySource source = new OriginTrackedSystemPropertySource(sourceName, - Collections.unmodifiableMap(originTrackedSource)); + originTrackedSource.entrySet().forEach(e -> e.setValue(OriginTrackedValue + .of(e.getValue(), new SystemEnvironmentOrigin(e.getKey())))); + OriginTrackedSystemPropertySource source = new OriginTrackedSystemPropertySource( + sourceName, Collections.unmodifiableMap(originTrackedSource)); environment.getPropertySources().replace(sourceName, source); } } @@ -78,4 +85,3 @@ public class SystemEnvironmentPropertySourceEnvironmentPostProcessor implements } } - diff --git a/spring-boot/src/main/java/org/springframework/boot/env/YamlPropertySourceLoader.java b/spring-boot/src/main/java/org/springframework/boot/env/YamlPropertySourceLoader.java index df3530e4ed..df85eeed89 100755 --- a/spring-boot/src/main/java/org/springframework/boot/env/YamlPropertySourceLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/YamlPropertySourceLoader.java @@ -41,7 +41,8 @@ public class YamlPropertySourceLoader implements PropertySourceLoader { public PropertySource load(String name, Resource resource, String profile) throws IOException { if (!ClassUtils.isPresent("org.yaml.snakeyaml.Yaml", null)) { - throw new IllegalStateException("Attempted to load " + name + " but snakeyaml was not found on the classpath"); + throw new IllegalStateException("Attempted to load " + name + + " but snakeyaml was not found on the classpath"); } Map source = new OriginTrackedYamlLoader(resource, profile) .load(); diff --git a/spring-boot/src/main/java/org/springframework/boot/origin/SystemEnvironmentOrigin.java b/spring-boot/src/main/java/org/springframework/boot/origin/SystemEnvironmentOrigin.java index 08d4593265..5379127973 100644 --- a/spring-boot/src/main/java/org/springframework/boot/origin/SystemEnvironmentOrigin.java +++ b/spring-boot/src/main/java/org/springframework/boot/origin/SystemEnvironmentOrigin.java @@ -64,4 +64,3 @@ public class SystemEnvironmentOrigin implements Origin { return ObjectUtils.nullSafeEquals(this.property, other.property); } } - diff --git a/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java b/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java index deaafadb1e..ee32bc361f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java +++ b/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java @@ -20,8 +20,8 @@ import org.springframework.core.io.Resource; import org.springframework.util.ObjectUtils; /** - * {@link Origin} for an item loaded from a text resource. Provides access to the - * original {@link Resource} that loaded the text and a {@link Location} within it. + * {@link Origin} for an item loaded from a text resource. Provides access to the original + * {@link Resource} that loaded the text and a {@link Location} within it. * * @author Madhura Bhave * @author Phillip Webb diff --git a/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyWebServer.java b/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyWebServer.java index c67a5dd35d..1113ce5612 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyWebServer.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyWebServer.java @@ -66,7 +66,7 @@ public class NettyWebServer implements WebServer { } catch (Exception ex) { if (findBindException(ex) != null) { -// throw new PortInUseException(); + // throw new PortInUseException(); } throw new WebServerException("Unable to start Netty", ex); } diff --git a/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java b/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java index 95752b4dfd..339d2a4025 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java @@ -25,8 +25,8 @@ import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils; /** - * Tomcat {@link StandardContext} used by {@link TomcatWebServer} to - * support deferred initialization. + * Tomcat {@link StandardContext} used by {@link TomcatWebServer} to support deferred + * initialization. * * @author Phillip Webb * @author Andy Wilkinson diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/AnnotationConfigServletWebServerApplicationContext.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/AnnotationConfigServletWebServerApplicationContext.java index 0b94b55b91..9174db756e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/AnnotationConfigServletWebServerApplicationContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/AnnotationConfigServletWebServerApplicationContext.java @@ -58,9 +58,9 @@ public class AnnotationConfigServletWebServerApplicationContext private String[] basePackages; /** - * Create a new {@link AnnotationConfigServletWebServerApplicationContext} that needs to be - * populated through {@link #register} calls and then manually {@linkplain #refresh - * refreshed}. + * Create a new {@link AnnotationConfigServletWebServerApplicationContext} that needs + * to be populated through {@link #register} calls and then manually + * {@linkplain #refresh refreshed}. */ public AnnotationConfigServletWebServerApplicationContext() { this.reader = new AnnotatedBeanDefinitionReader(this); @@ -68,21 +68,23 @@ public class AnnotationConfigServletWebServerApplicationContext } /** - * Create a new {@link AnnotationConfigServletWebServerApplicationContext}, deriving bean - * definitions from the given annotated classes and automatically refreshing the + * Create a new {@link AnnotationConfigServletWebServerApplicationContext}, deriving + * bean definitions from the given annotated classes and automatically refreshing the * context. * @param annotatedClasses one or more annotated classes, e.g. {@code @Configuration} * classes */ - public AnnotationConfigServletWebServerApplicationContext(Class... annotatedClasses) { + public AnnotationConfigServletWebServerApplicationContext( + Class... annotatedClasses) { this(); register(annotatedClasses); refresh(); } /** - * Create a new {@link AnnotationConfigServletWebServerApplicationContext}, scanning for - * bean definitions in the given packages and automatically refreshing the context. + * Create a new {@link AnnotationConfigServletWebServerApplicationContext}, scanning + * for bean definitions in the given packages and automatically refreshing the + * context. * @param basePackages the packages to check for annotated classes */ public AnnotationConfigServletWebServerApplicationContext(String... basePackages) { diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerInitializedEvent.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerInitializedEvent.java index d1e33b5327..7d33f87d17 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerInitializedEvent.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerInitializedEvent.java @@ -36,8 +36,8 @@ public class ServletWebServerInitializedEvent extends WebServerInitializedEvent private final ServletWebServerApplicationContext applicationContext; - public ServletWebServerInitializedEvent( - WebServer source, ServletWebServerApplicationContext applicationContext) { + public ServletWebServerInitializedEvent(WebServer source, + ServletWebServerApplicationContext applicationContext) { super(source); this.applicationContext = applicationContext; } diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/XmlServletWebServerApplicationContext.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/XmlServletWebServerApplicationContext.java index f21599782f..2f05dfb856 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/XmlServletWebServerApplicationContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/XmlServletWebServerApplicationContext.java @@ -23,8 +23,9 @@ import org.springframework.core.io.Resource; import org.springframework.web.context.support.XmlWebApplicationContext; /** - * {@link ServletWebServerApplicationContext} which takes its configuration from XML documents, - * understood by an {@link org.springframework.beans.factory.xml.XmlBeanDefinitionReader}. + * {@link ServletWebServerApplicationContext} which takes its configuration from XML + * documents, understood by an + * {@link org.springframework.beans.factory.xml.XmlBeanDefinitionReader}. *

* Note: In case of multiple config locations, later bean definitions will override ones * defined in earlier loaded files. This can be leveraged to deliberately override certain @@ -36,7 +37,8 @@ import org.springframework.web.context.support.XmlWebApplicationContext; * @see ServletWebServerApplicationContext * @see XmlWebApplicationContext */ -public class XmlServletWebServerApplicationContext extends ServletWebServerApplicationContext { +public class XmlServletWebServerApplicationContext + extends ServletWebServerApplicationContext { private final XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this); @@ -49,8 +51,8 @@ public class XmlServletWebServerApplicationContext extends ServletWebServerAppli } /** - * Create a new {@link XmlServletWebServerApplicationContext}, loading bean definitions from - * the given resources and automatically refreshing the context. + * Create a new {@link XmlServletWebServerApplicationContext}, loading bean + * definitions from the given resources and automatically refreshing the context. * @param resources the resources to load from */ public XmlServletWebServerApplicationContext(Resource... resources) { @@ -59,8 +61,9 @@ public class XmlServletWebServerApplicationContext extends ServletWebServerAppli } /** - * Create a new {@link XmlServletWebServerApplicationContext}, loading bean definitions from - * the given resource locations and automatically refreshing the context. + * Create a new {@link XmlServletWebServerApplicationContext}, loading bean + * definitions from the given resource locations and automatically refreshing the + * context. * @param resourceLocations the resources to load from */ public XmlServletWebServerApplicationContext(String... resourceLocations) { @@ -69,8 +72,9 @@ public class XmlServletWebServerApplicationContext extends ServletWebServerAppli } /** - * Create a new {@link XmlServletWebServerApplicationContext}, loading bean definitions from - * the given resource locations and automatically refreshing the context. + * Create a new {@link XmlServletWebServerApplicationContext}, loading bean + * definitions from the given resource locations and automatically refreshing the + * context. * @param relativeClass class whose package will be used as a prefix when loading each * specified resource name * @param resourceNames relatively-qualified names of resources to load diff --git a/spring-boot/src/test/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrarTests.java b/spring-boot/src/test/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrarTests.java index fbe645b2c0..9651b0fdb2 100644 --- a/spring-boot/src/test/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrarTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrarTests.java @@ -99,8 +99,9 @@ public class SpringApplicationAdminMXBeanRegistrarTests { ConfigurableApplicationContext context = mock( ConfigurableApplicationContext.class); registrar.setApplicationContext(context); - registrar.onApplicationReadyEvent(new ApplicationReadyEvent(new SpringApplication(), - null, mock(ConfigurableApplicationContext.class))); + registrar.onApplicationReadyEvent( + new ApplicationReadyEvent(new SpringApplication(), null, + mock(ConfigurableApplicationContext.class))); assertThat(isApplicationReady(registrar)).isFalse(); registrar.onApplicationReadyEvent( new ApplicationReadyEvent(new SpringApplication(), null, context)); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java b/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java index 71b6ebe9ed..a01a46b87b 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java @@ -216,18 +216,19 @@ public class BinderTests { } @Test - public void bindExceptionWhenBeanBindingFailsShouldHaveNullConfigurationProperty() throws Exception { + public void bindExceptionWhenBeanBindingFailsShouldHaveNullConfigurationProperty() + throws Exception { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.value", "hello"); source.put("foo.items", "bar,baz"); - this.sources - .add(source); + this.sources.add(source); Bindable target = Bindable.of(JavaBean.class); this.thrown.expect(BindException.class); this.thrown.expect(new AssertionMatcher() { @Override public void assertion(BindException ex) throws AssertionError { - assertThat(ex.getCause().getMessage()).isEqualTo("No setter found for property: items"); + assertThat(ex.getCause().getMessage()) + .isEqualTo("No setter found for property: items"); assertThat(ex.getProperty()).isNull(); } }); diff --git a/spring-boot/src/test/java/org/springframework/boot/env/NoSnakeYamlPropertySourceLoaderTests.java b/spring-boot/src/test/java/org/springframework/boot/env/NoSnakeYamlPropertySourceLoaderTests.java index b8c135808a..41ac5964bb 100644 --- a/spring-boot/src/test/java/org/springframework/boot/env/NoSnakeYamlPropertySourceLoaderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/env/NoSnakeYamlPropertySourceLoaderTests.java @@ -42,11 +42,11 @@ public class NoSnakeYamlPropertySourceLoaderTests { @Test public void load() throws Exception { this.thrown.expect(IllegalStateException.class); - this.thrown.expectMessage("Attempted to load resource but snakeyaml was not found on the classpath"); + this.thrown.expectMessage( + "Attempted to load resource but snakeyaml was not found on the classpath"); ByteArrayResource resource = new ByteArrayResource( "foo:\n bar: spam".getBytes()); this.loader.load("resource", resource, null); } } - diff --git a/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java b/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java index 3617b5ad9c..77eff0c05c 100644 --- a/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java @@ -236,8 +236,7 @@ public class OriginTrackedPropertiesLoaderTests { if (value == null) { return null; } - return ((TextResourceOrigin) value.getOrigin()).getLocation() - .toString(); + return ((TextResourceOrigin) value.getOrigin()).getLocation().toString(); } } diff --git a/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedYamlLoaderTests.java b/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedYamlLoaderTests.java index 094f7a30a0..af062965c7 100644 --- a/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedYamlLoaderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedYamlLoaderTests.java @@ -122,8 +122,7 @@ public class OriginTrackedYamlLoaderTests { } private String getLocation(OriginTrackedValue value) { - return ((TextResourceOrigin) value.getOrigin()).getLocation() - .toString(); + return ((TextResourceOrigin) value.getOrigin()).getLocation().toString(); } } diff --git a/spring-boot/src/test/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessorTests.java b/spring-boot/src/test/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessorTests.java index 5f711e5964..0523f14857 100644 --- a/spring-boot/src/test/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessorTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessorTests.java @@ -44,10 +44,12 @@ public class SystemEnvironmentPropertySourceEnvironmentPostProcessorTests { } @Test - public void postProcessShouldReplaceSystemEnviromentPropertySource() throws Exception { + public void postProcessShouldReplaceSystemEnviromentPropertySource() + throws Exception { SystemEnvironmentPropertySourceEnvironmentPostProcessor postProcessor = new SystemEnvironmentPropertySourceEnvironmentPostProcessor(); postProcessor.postProcessEnvironment(this.environment, null); - PropertySource replaced = this.environment.getPropertySources().get("systemEnvironment"); + PropertySource replaced = this.environment.getPropertySources() + .get("systemEnvironment"); assertThat(replaced).isInstanceOf(OriginTrackedSystemPropertySource.class); } @@ -55,15 +57,19 @@ public class SystemEnvironmentPropertySourceEnvironmentPostProcessorTests { @SuppressWarnings("unchecked") public void replacedPropertySourceShouldHaveOriginTrackedValues() throws Exception { SystemEnvironmentPropertySourceEnvironmentPostProcessor postProcessor = new SystemEnvironmentPropertySourceEnvironmentPostProcessor(); - PropertySource original = this.environment.getPropertySources().get("systemEnvironment"); + PropertySource original = this.environment.getPropertySources() + .get("systemEnvironment"); postProcessor.postProcessEnvironment(this.environment, null); - PropertySource replaced = this.environment.getPropertySources().get("systemEnvironment"); + PropertySource replaced = this.environment.getPropertySources() + .get("systemEnvironment"); Map originalMap = (Map) original.getSource(); - Map replacedMap = (Map) replaced.getSource(); + Map replacedMap = (Map) replaced + .getSource(); for (Map.Entry entry : originalMap.entrySet()) { OriginTrackedValue actual = replacedMap.get(entry.getKey()); assertThat(actual.getValue()).isEqualTo(entry.getValue()); - assertThat(actual.getOrigin()).isEqualTo(new SystemEnvironmentOrigin(entry.getKey())); + assertThat(actual.getOrigin()) + .isEqualTo(new SystemEnvironmentOrigin(entry.getKey())); } } diff --git a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosPropertiesTests.java b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosPropertiesTests.java index 64a8d67434..14e4f794e7 100644 --- a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosPropertiesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosPropertiesTests.java @@ -94,9 +94,8 @@ public class AtomikosPropertiesTests { "com.atomikos.icatch.forget_orphaned_log_entries_delay", "com.atomikos.icatch.oltp_max_retries", "com.atomikos.icatch.oltp_retry_interval")); - assertThat(properties).contains( - entry("com.atomikos.icatch.recovery_delay", defaultSettings.get( - "com.atomikos.icatch.default_jta_timeout"))); + assertThat(properties).contains(entry("com.atomikos.icatch.recovery_delay", + defaultSettings.get("com.atomikos.icatch.default_jta_timeout"))); assertThat(properties).hasSize(14); } diff --git a/spring-boot/src/test/java/org/springframework/boot/origin/SystemEnvironmentOriginTests.java b/spring-boot/src/test/java/org/springframework/boot/origin/SystemEnvironmentOriginTests.java index 8b4b769cdb..07a18e29e8 100644 --- a/spring-boot/src/test/java/org/springframework/boot/origin/SystemEnvironmentOriginTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/origin/SystemEnvironmentOriginTests.java @@ -53,6 +53,7 @@ public class SystemEnvironmentOriginTests { @Test public void toStringShouldReturnStringWithDetails() throws Exception { SystemEnvironmentOrigin origin = new SystemEnvironmentOrigin("FOO_BAR"); - assertThat(origin.toString()).isEqualTo("System Environment Property \"FOO_BAR\""); + assertThat(origin.toString()) + .isEqualTo("System Environment Property \"FOO_BAR\""); } }