diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.java index fde114ebb5..0a85a34cc7 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.java @@ -42,7 +42,6 @@ import org.springframework.data.cassandra.core.CassandraAdminOperations; import org.springframework.data.cassandra.core.CassandraTemplate; import org.springframework.data.cassandra.core.convert.CassandraConverter; import org.springframework.data.cassandra.core.convert.MappingCassandraConverter; -import org.springframework.data.cassandra.core.mapping.BasicCassandraMappingContext; import org.springframework.data.cassandra.core.mapping.CassandraMappingContext; import org.springframework.data.cassandra.core.mapping.SimpleUserTypeResolver; import org.springframework.util.StringUtils; @@ -81,7 +80,7 @@ public class CassandraDataAutoConfiguration { @Bean @ConditionalOnMissingBean public CassandraMappingContext cassandraMapping() throws ClassNotFoundException { - BasicCassandraMappingContext context = new BasicCassandraMappingContext(); + CassandraMappingContext context = new CassandraMappingContext(); List packages = EntityScanPackages.get(this.beanFactory) .getPackageNames(); if (packages.isEmpty() && AutoConfigurationPackages.has(this.beanFactory)) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveRepositoriesAutoConfigurationTests.java index a2d5386409..581631e604 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveRepositoriesAutoConfigurationTests.java @@ -36,7 +36,7 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.FilterType; -import org.springframework.data.cassandra.core.mapping.BasicCassandraMappingContext; +import org.springframework.data.cassandra.core.mapping.CassandraMappingContext; import org.springframework.data.cassandra.repository.config.EnableReactiveCassandraRepositories; import org.springframework.data.cql.core.session.ReactiveSession; import org.springframework.test.util.ReflectionTestUtils; @@ -87,8 +87,8 @@ public class CassandraReactiveRepositoriesAutoConfigurationTests { @SuppressWarnings("unchecked") private Set> getInitialEntitySet() { - BasicCassandraMappingContext mappingContext = this.context - .getBean(BasicCassandraMappingContext.class); + CassandraMappingContext mappingContext = this.context + .getBean(CassandraMappingContext.class); return (Set>) ReflectionTestUtils.getField(mappingContext, "initialEntitySet"); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigurationTests.java index 4c3d32ec31..2a844267ad 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigurationTests.java @@ -36,7 +36,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.FilterType; -import org.springframework.data.cassandra.core.mapping.BasicCassandraMappingContext; +import org.springframework.data.cassandra.core.mapping.CassandraMappingContext; import org.springframework.data.cassandra.repository.config.EnableCassandraRepositories; import org.springframework.test.util.ReflectionTestUtils; @@ -88,8 +88,8 @@ public class CassandraRepositoriesAutoConfigurationTests { @SuppressWarnings("unchecked") private Set> getInitialEntitySet() { - BasicCassandraMappingContext mappingContext = this.context - .getBean(BasicCassandraMappingContext.class); + CassandraMappingContext mappingContext = this.context + .getBean(CassandraMappingContext.class); return (Set>) ReflectionTestUtils.getField(mappingContext, "initialEntitySet"); } 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 d9b6d60e21..3a6971fd00 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 @@ -210,19 +210,16 @@ public class DataSourceAutoConfigurationTests { @Test public void testExplicitDriverClassClearsUsername() throws Exception { TestPropertyValues.of( - "spring.datasource.driverClassName:" - + "org.springframework.boot.autoconfigure.jdbc." - + "DataSourceAutoConfigurationTests$DatabaseTestDriver", + "spring.datasource.driverClassName:" + DatabaseTestDriver.class.getName(), "spring.datasource.url:jdbc:foo://localhost").applyTo(this.context); this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class); this.context.refresh(); - DataSource bean = this.context.getBean(DataSource.class); - assertThat(bean).isNotNull(); - HikariDataSource pool = (HikariDataSource) bean; - assertThat(pool.getDriverClassName()).isEqualTo( - "org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfigurationTests$DatabaseTestDriver"); - assertThat(pool.getUsername()).isNull(); + DataSource dataSource = this.context.getBean(DataSource.class); + assertThat(dataSource).isNotNull(); + assertThat(((HikariDataSource) dataSource).getDriverClassName()) + .isEqualTo(DatabaseTestDriver.class.getName()); + assertThat(((HikariDataSource) dataSource).getUsername()).isNull(); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java index b79f447ee1..c20e7dde58 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java @@ -168,6 +168,7 @@ public class KafkaAutoConfigurationTests { .isEmpty(); } + @SuppressWarnings("unchecked") @Test public void listenerProperties() { load("spring.kafka.template.default-topic=testTopic", @@ -176,8 +177,8 @@ public class KafkaAutoConfigurationTests { "spring.kafka.listener.ack-time=456", "spring.kafka.listener.concurrency=3", "spring.kafka.listener.poll-timeout=2000", - "spring.kafka.listener.type=batch", - "spring.kafka.jaas.enabled=true", "spring.kafka.jaas.login-module=foo", + "spring.kafka.listener.type=batch", "spring.kafka.jaas.enabled=true", + "spring.kafka.jaas.login-module=foo", "spring.kafka.jaas.control-flag=REQUISITE", "spring.kafka.jaas.options.useKeyTab=true"); DefaultKafkaProducerFactory producerFactory = this.context @@ -199,8 +200,7 @@ public class KafkaAutoConfigurationTests { assertThat(dfa.getPropertyValue("concurrency")).isEqualTo(3); assertThat(dfa.getPropertyValue("containerProperties.pollTimeout")) .isEqualTo(2000L); - assertThat(dfa.getPropertyValue("batchListener")) - .isEqualTo(true); + assertThat(dfa.getPropertyValue("batchListener")).isEqualTo(true); assertThat(this.context.getBeansOfType(KafkaJaasLoginModuleInitializer.class)) .hasSize(1); KafkaJaasLoginModuleInitializer jaas = 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 a4b8811e73..8212e2a884 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 @@ -354,11 +354,8 @@ public class QuartzAutoConfigurationTests { public static class ComponentThatUsesScheduler { - private Scheduler scheduler; - public ComponentThatUsesScheduler(Scheduler scheduler) { Assert.notNull(scheduler, "Scheduler must not be null"); - this.scheduler = scheduler; } } diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java index 3a3df4f716..dda11b23b1 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java @@ -216,8 +216,8 @@ final class ClassLoaderFilesResourcePatternResolver implements ResourcePatternRe ApplicationContext applicationContext) { DefaultResourceLoader resourceLoader = new DefaultResourceLoader(); if (applicationContext instanceof DefaultResourceLoader) { - Collection protocolResolvers = - ((DefaultResourceLoader) applicationContext).getProtocolResolvers(); + Collection protocolResolvers = ((DefaultResourceLoader) applicationContext) + .getProtocolResolvers(); for (ProtocolResolver protocolResolver : protocolResolvers) { resourceLoader.addProtocolResolver(protocolResolver); } @@ -247,11 +247,11 @@ final class ClassLoaderFilesResourcePatternResolver implements ResourcePatternRe private ResourceLoader createResourceLoader( WebApplicationContext applicationContext) { - WebApplicationContextResourceLoader resourceLoader = - new WebApplicationContextResourceLoader(applicationContext); + WebApplicationContextResourceLoader resourceLoader = new WebApplicationContextResourceLoader( + applicationContext); if (applicationContext instanceof DefaultResourceLoader) { - Collection protocolResolvers = - ((DefaultResourceLoader) applicationContext).getProtocolResolvers(); + Collection protocolResolvers = ((DefaultResourceLoader) applicationContext) + .getProtocolResolvers(); for (ProtocolResolver protocolResolver : protocolResolvers) { resourceLoader.addProtocolResolver(protocolResolver); } diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/AbstractDevToolsDataSourceAutoConfigurationTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/AbstractDevToolsDataSourceAutoConfigurationTests.java index 304a75c8f6..065f6db328 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/AbstractDevToolsDataSourceAutoConfigurationTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/AbstractDevToolsDataSourceAutoConfigurationTests.java @@ -110,8 +110,9 @@ public abstract class AbstractDevToolsDataSourceAutoConfigurationTests { context.register(classes); context.register(DevToolsDataSourceAutoConfiguration.class); if (driverClassName != null) { - TestPropertyValues.of( - "spring.datasource.driver-class-name:" + driverClassName).applyTo(context); + TestPropertyValues + .of("spring.datasource.driver-class-name:" + driverClassName) + .applyTo(context); } if (url != null) { TestPropertyValues.of("spring.datasource.url:" + url).applyTo(context); diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolverTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolverTests.java index 7a3254b8c8..63af6551e0 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolverTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolverTests.java @@ -39,9 +39,9 @@ import org.springframework.web.context.support.GenericWebApplicationContext; import org.springframework.web.context.support.ServletContextResource; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -168,8 +168,7 @@ public class ClassLoaderFilesResourcePatternResolverTests { private ProtocolResolver mockProtocolResolver(String path, Resource resource) { ProtocolResolver resolver = mock(ProtocolResolver.class); - given(resolver.resolve(eq(path), any(ResourceLoader.class))) - .willReturn(resource); + given(resolver.resolve(eq(path), any(ResourceLoader.class))).willReturn(resource); return resolver; } diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/src/test/java/sample/hypermedia/ui/secure/SampleHypermediaUiSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/src/test/java/sample/hypermedia/ui/secure/SampleHypermediaUiSecureApplicationTests.java index 57495667ff..7ad09c94fe 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/src/test/java/sample/hypermedia/ui/secure/SampleHypermediaUiSecureApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/src/test/java/sample/hypermedia/ui/secure/SampleHypermediaUiSecureApplicationTests.java @@ -47,16 +47,16 @@ public class SampleHypermediaUiSecureApplicationTests { ResponseEntity entity = this.restTemplate.getForEntity("/application/env", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); - ResponseEntity user = this.restTemplate.getForEntity("/application/env/foo", - String.class); + ResponseEntity user = this.restTemplate + .getForEntity("/application/env/foo", String.class); assertThat(user.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(user.getBody()).contains("{\"foo\":"); } @Test public void testSecurePath() throws Exception { - ResponseEntity entity = this.restTemplate.getForEntity("/application/metrics", - String.class); + ResponseEntity entity = this.restTemplate + .getForEntity("/application/metrics", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); } } diff --git a/spring-boot-samples/spring-boot-sample-jpa/src/main/java/sample/jpa/domain/Tag.java b/spring-boot-samples/spring-boot-sample-jpa/src/main/java/sample/jpa/domain/Tag.java index 3182d5d25b..d93cfbd33e 100644 --- a/spring-boot-samples/spring-boot-sample-jpa/src/main/java/sample/jpa/domain/Tag.java +++ b/spring-boot-samples/spring-boot-sample-jpa/src/main/java/sample/jpa/domain/Tag.java @@ -20,7 +20,6 @@ import java.util.List; import javax.persistence.Entity; import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToMany; import javax.persistence.SequenceGenerator; @@ -29,7 +28,7 @@ import javax.persistence.SequenceGenerator; public class Tag { @Id - @SequenceGenerator(name="tag_generator", sequenceName="tag_sequence", initialValue = 4) + @SequenceGenerator(name = "tag_generator", sequenceName = "tag_sequence", initialValue = 4) @GeneratedValue(generator = "tag_generator") private long id; diff --git a/spring-boot-samples/spring-boot-sample-quartz/src/main/java/sample/quartz/SampleJob.java b/spring-boot-samples/spring-boot-sample-quartz/src/main/java/sample/quartz/SampleJob.java index b1d3db23ca..e00d71d8fe 100644 --- a/spring-boot-samples/spring-boot-sample-quartz/src/main/java/sample/quartz/SampleJob.java +++ b/spring-boot-samples/spring-boot-sample-quartz/src/main/java/sample/quartz/SampleJob.java @@ -22,7 +22,7 @@ import org.quartz.JobExecutionException; import org.springframework.scheduling.quartz.QuartzJobBean; public class SampleJob extends QuartzJobBean { - + private String name; // Invoked if a Job data map entry with that name diff --git a/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/test/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/test/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplicationTests.java index 4c1ff5e6dc..837704889c 100644 --- a/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/test/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/test/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplicationTests.java @@ -70,7 +70,8 @@ public class SampleSecureOAuth2ActuatorApplicationTests { @Test public void healthAvailable() throws Exception { - this.mvc.perform(get("/application/health")).andExpect(status().isOk()).andDo(print()); + this.mvc.perform(get("/application/health")).andExpect(status().isOk()) + .andDo(print()); } @Test diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactory.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactory.java index c59967788b..cc03f38616 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactory.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactory.java @@ -56,8 +56,9 @@ class OverrideAutoConfigurationContextCustomizerFactory @Override public void customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig) { - TestPropertyValues.of( - EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY + "=false").applyTo(context); + TestPropertyValues + .of(EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY + "=false") + .applyTo(context); } @Override diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/AutoConfigureDataLdap.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/AutoConfigureDataLdap.java index a0a913ef14..4b1c1cd156 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/AutoConfigureDataLdap.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/AutoConfigureDataLdap.java @@ -26,9 +26,9 @@ import java.lang.annotation.Target; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; /** - * {@link ImportAutoConfiguration Auto-configuration imports} for typical Data LDAP - * tests. Most tests should consider using {@link DataLdapTest @DataLdapTest} rather - * than using this annotation directly. + * {@link ImportAutoConfiguration Auto-configuration imports} for typical Data LDAP tests. + * Most tests should consider using {@link DataLdapTest @DataLdapTest} rather than using + * this annotation directly. * * @author EddĂș MelĂ©ndez * @since 2.0.0 diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTest.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTest.java index 999ddf1a73..362f89cf70 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTest.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTest.java @@ -35,8 +35,8 @@ import org.springframework.test.context.BootstrapWith; /** * Annotation that can be used in combination with {@code @RunWith(SpringRunner.class)} - * for a typical LDAP test. Can be used when a test focuses only on - * LDAP components. + * for a typical LDAP test. Can be used when a test focuses only on LDAP + * components. *

* Using this annotation will disable full auto-configuration and instead apply only * configuration relevant to LDAP tests. diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTypeExcludeFilter.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTypeExcludeFilter.java index ee96be80d5..3484e18b90 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTypeExcludeFilter.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTypeExcludeFilter.java @@ -46,12 +46,12 @@ class DataLdapTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter @Override protected Filter[] getFilters(FilterType type) { switch (type) { - case INCLUDE: - return this.annotation.includeFilters(); - case EXCLUDE: - return this.annotation.excludeFilters(); - default: - throw new IllegalStateException("Unsupported type " + type); + case INCLUDE: + return this.annotation.includeFilters(); + case EXCLUDE: + return this.annotation.excludeFilters(); + default: + throw new IllegalStateException("Unsupported type " + type); } } diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTypeExcludeFilter.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTypeExcludeFilter.java index e379718a1f..412d80dd51 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTypeExcludeFilter.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTypeExcludeFilter.java @@ -46,12 +46,12 @@ class DataNeo4jTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter @Override protected Filter[] getFilters(FilterType type) { switch (type) { - case INCLUDE: - return this.annotation.includeFilters(); - case EXCLUDE: - return this.annotation.excludeFilters(); - default: - throw new IllegalStateException("Unsupported type " + type); + case INCLUDE: + return this.annotation.includeFilters(); + case EXCLUDE: + return this.annotation.excludeFilters(); + default: + throw new IllegalStateException("Unsupported type " + type); } } diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTypeExcludeFilter.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTypeExcludeFilter.java index b8585cf459..835fc01da8 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTypeExcludeFilter.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTypeExcludeFilter.java @@ -46,12 +46,12 @@ class DataRedisTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter @Override protected Filter[] getFilters(FilterType type) { switch (type) { - case INCLUDE: - return this.annotation.includeFilters(); - case EXCLUDE: - return this.annotation.excludeFilters(); - default: - throw new IllegalStateException("Unsupported type " + type); + case INCLUDE: + return this.annotation.includeFilters(); + case EXCLUDE: + return this.annotation.excludeFilters(); + default: + throw new IllegalStateException("Unsupported type " + type); } } diff --git a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestIntegrationTests.java b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestIntegrationTests.java index 3108522626..d667eb08df 100644 --- a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestIntegrationTests.java +++ b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestIntegrationTests.java @@ -42,8 +42,8 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) @DataLdapTest -@TestPropertySource(properties = {"spring.ldap.embedded.base-dn=dc=spring,dc=org", -"spring.ldap.embedded.ldif=classpath:org/springframework/boot/test/autoconfigure/data/ldap/schema.ldif"}) +@TestPropertySource(properties = { "spring.ldap.embedded.base-dn=dc=spring,dc=org", + "spring.ldap.embedded.ldif=classpath:org/springframework/boot/test/autoconfigure/data/ldap/schema.ldif" }) public class DataLdapTestIntegrationTests { @Rule @@ -63,10 +63,11 @@ public class DataLdapTestIntegrationTests { LdapQuery ldapQuery = LdapQueryBuilder.query().where("cn").is("Bob Smith"); Optional entry = this.exampleRepository.findOne(ldapQuery); assertThat(entry.isPresent()); - assertThat(entry.get().getDn()) - .isEqualTo(LdapUtils.newLdapName("cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org")); - assertThat(this.ldapTemplate.findOne(ldapQuery, ExampleEntry.class) .getDn()) - .isEqualTo(LdapUtils.newLdapName("cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org")); + assertThat(entry.get().getDn()).isEqualTo(LdapUtils + .newLdapName("cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org")); + assertThat(this.ldapTemplate.findOne(ldapQuery, ExampleEntry.class).getDn()) + .isEqualTo(LdapUtils.newLdapName( + "cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org")); } @Test diff --git a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestWithIncludeFilterIntegrationTests.java b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestWithIncludeFilterIntegrationTests.java index 019e51a6ca..d96328615f 100644 --- a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestWithIncludeFilterIntegrationTests.java +++ b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestWithIncludeFilterIntegrationTests.java @@ -36,8 +36,8 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) @DataLdapTest(includeFilters = @Filter(Service.class)) -@TestPropertySource(properties = {"spring.ldap.embedded.base-dn=dc=spring,dc=org", - "spring.ldap.embedded.ldif=classpath:org/springframework/boot/test/autoconfigure/data/ldap/schema.ldif"}) +@TestPropertySource(properties = { "spring.ldap.embedded.base-dn=dc=spring,dc=org", + "spring.ldap.embedded.ldif=classpath:org/springframework/boot/test/autoconfigure/data/ldap/schema.ldif" }) public class DataLdapTestWithIncludeFilterIntegrationTests { @Autowired diff --git a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestWithIncludeFilterIntegrationTests.java b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestWithIncludeFilterIntegrationTests.java index d0ab9e750b..5c1230a3d0 100644 --- a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestWithIncludeFilterIntegrationTests.java +++ b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestWithIncludeFilterIntegrationTests.java @@ -38,7 +38,7 @@ public class DataNeo4jTestWithIncludeFilterIntegrationTests { @Rule public Neo4jTestServer server = new Neo4jTestServer( - new String[]{"org.springframework.boot.test.autoconfigure.data.neo4j"}); + new String[] { "org.springframework.boot.test.autoconfigure.data.neo4j" }); @Autowired private ExampleService service; diff --git a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/Neo4jTestServer.java b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/Neo4jTestServer.java index 9f2636a735..b7e2c4f74f 100644 --- a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/Neo4jTestServer.java +++ b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/Neo4jTestServer.java @@ -104,8 +104,9 @@ public class Neo4jTestServer implements TestRule { @Override public void evaluate() throws Throwable { - Assume.assumeTrue("Skipping test due to Neo4j SessionFactory" - + " not being available", false); + Assume.assumeTrue( + "Skipping test due to Neo4j SessionFactory" + " not being available", + false); } } diff --git a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestIntegrationTests.java b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestIntegrationTests.java index 32d3307997..e60ca1f171 100644 --- a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestIntegrationTests.java +++ b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestIntegrationTests.java @@ -66,7 +66,8 @@ public class DataRedisTestIntegrationTests { assertThat(personHash.getId()).isNull(); PersonHash savedEntity = this.exampleRepository.save(personHash); assertThat(savedEntity.getId()).isNotNull(); - assertThat(this.operations.execute((RedisConnection connection) -> connection.exists(("persons:" + savedEntity.getId()).getBytes(CHARSET)))).isTrue(); + assertThat(this.operations.execute((RedisConnection connection) -> connection + .exists(("persons:" + savedEntity.getId()).getBytes(CHARSET)))).isTrue(); this.exampleRepository.deleteAll(); } diff --git a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/ExampleService.java b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/ExampleService.java index 48246437e8..a3b29170ce 100644 --- a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/ExampleService.java +++ b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/ExampleService.java @@ -39,8 +39,8 @@ public class ExampleService { } public boolean hasRecord(PersonHash personHash) { - return this.operations.execute((RedisConnection connection) -> - connection.exists(("persons:" + personHash.getId()).getBytes(CHARSET))); + return this.operations.execute((RedisConnection connection) -> connection + .exists(("persons:" + personHash.getId()).getBytes(CHARSET))); } } diff --git a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/ExampleException.java b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/ExampleException.java index 17f6643a37..1a89bde00e 100644 --- a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/ExampleException.java +++ b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/ExampleException.java @@ -17,6 +17,7 @@ package org.springframework.boot.test.autoconfigure.web.servlet.mockmvc; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; + /** * Example exception used in {@link WebMvcTest} tests. * diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java index d1601b776e..1ec698716b 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java @@ -150,8 +150,10 @@ public class SpringBootContextLoader extends AbstractContextLoader { private void setActiveProfiles(ConfigurableEnvironment environment, String[] profiles) { - TestPropertyValues.of("spring.profiles.active=" - + StringUtils.arrayToCommaDelimitedString(profiles)).applyTo(environment); + TestPropertyValues + .of("spring.profiles.active=" + + StringUtils.arrayToCommaDelimitedString(profiles)) + .applyTo(environment); } protected String[] getInlinedProperties(MergedContextConfiguration config) { diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java index 8856997b2d..8bcf236acd 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java @@ -31,15 +31,15 @@ import org.springframework.web.reactive.config.EnableWebFlux; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link SpringBootTest} in a reactive environment configured with - * a user-defined {@link RestTemplate} that is named {@code testRestTemplate}. + * Tests for {@link SpringBootTest} in a reactive environment configured with a + * user-defined {@link RestTemplate} that is named {@code testRestTemplate}. * * @author Madhura Bhave */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, - properties = { "spring.main.web-application-type=reactive", "value=123" }) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { + "spring.main.web-application-type=reactive", "value=123" }) public class SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests extends AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests { diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/util/EnvironmentTestUtilsTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/util/EnvironmentTestUtilsTests.java index c7fa64624f..4b57d281bb 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/util/EnvironmentTestUtilsTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/util/EnvironmentTestUtilsTests.java @@ -32,6 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Stephane Nicoll */ +@Deprecated public class EnvironmentTestUtilsTests { private final ConfigurableEnvironment environment = new StandardEnvironment(); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java index 99038aef90..7b1636c221 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java @@ -71,8 +71,8 @@ public class ItemDeprecation { @Override public String toString() { return "ItemDeprecation{" + "reason='" + this.reason + '\'' + ", " - + "replacement='" + this.replacement + '\'' + ", " - + "level='" + this.level + '\'' + '}'; + + "replacement='" + this.replacement + '\'' + ", " + "level='" + + this.level + '\'' + '}'; } @Override diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java index ede41fba0d..9aa0ee352e 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java @@ -556,16 +556,14 @@ public class ConfigurationMetadataAnnotationProcessorTests { @Test public void mergeExistingPropertyDeprecation() throws Exception { ItemMetadata property = ItemMetadata.newProperty("simple", "comparator", null, - null, null, null, null, - new ItemDeprecation("Don't use this.", "simple.complex-comparator", - "error")); + null, null, null, null, new ItemDeprecation("Don't use this.", + "simple.complex-comparator", "error")); writeAdditionalMetadata(property); ConfigurationMetadata metadata = compile(SimpleProperties.class); assertThat(metadata) .has(Metadata.withProperty("simple.comparator", "java.util.Comparator") - .fromSource(SimpleProperties.class) - .withDeprecation("Don't use this.", "simple.complex-comparator", - "error")); + .fromSource(SimpleProperties.class).withDeprecation( + "Don't use this.", "simple.complex-comparator", "error")); assertThat(metadata.getItems()).hasSize(4); } @@ -591,8 +589,8 @@ public class ConfigurationMetadataAnnotationProcessorTests { ConfigurationMetadata metadata = compile(DeprecatedSingleProperty.class); assertThat(metadata).has( Metadata.withProperty("singledeprecated.name", String.class.getName()) - .fromSource(DeprecatedSingleProperty.class) - .withDeprecation("renamed", "singledeprecated.new-name", "error")); + .fromSource(DeprecatedSingleProperty.class).withDeprecation( + "renamed", "singledeprecated.new-name", "error")); assertThat(metadata.getItems()).hasSize(3); } diff --git a/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/rule/RedisTestServer.java b/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/rule/RedisTestServer.java index e6f8a98d84..ed1d81b32a 100644 --- a/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/rule/RedisTestServer.java +++ b/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/rule/RedisTestServer.java @@ -63,12 +63,10 @@ public class RedisTestServer implements TestRule { ClassLoader classLoader = RedisTestServer.class.getClassLoader(); RedisConnectionFactory cf; if (ClassUtils.isPresent("redis.clients.jedis.Jedis", classLoader)) { - cf = new JedisConnectionFactoryConfiguration() - .createConnectionFactory(); + cf = new JedisConnectionFactoryConfiguration().createConnectionFactory(); } else { - cf = new LettuceConnectionFactoryConfiguration() - .createConnectionFactory(); + cf = new LettuceConnectionFactoryConfiguration().createConnectionFactory(); } testConnection(cf); @@ -142,8 +140,7 @@ public class RedisTestServer implements TestRule { RedisConnectionFactory createConnectionFactory() { LettuceClientConfiguration config = LettuceClientConfiguration.builder() - .shutdownTimeout(Duration.ofMillis(0)) - .build(); + .shutdownTimeout(Duration.ofMillis(0)).build(); LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory( new RedisStandaloneConfiguration(), config); connectionFactory.afterPropertiesSet(); diff --git a/spring-boot/src/main/java/org/springframework/boot/jackson/JsonComponentModule.java b/spring-boot/src/main/java/org/springframework/boot/jackson/JsonComponentModule.java index aa2708b9d5..e35641de20 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jackson/JsonComponentModule.java +++ b/spring-boot/src/main/java/org/springframework/boot/jackson/JsonComponentModule.java @@ -79,8 +79,8 @@ public class JsonComponentModule extends SimpleModule implements BeanFactoryAwar addDeserializerWithDeducedType((JsonDeserializer) bean); } for (Class innerClass : bean.getClass().getDeclaredClasses()) { - if (!Modifier.isAbstract(innerClass.getModifiers()) && - (JsonSerializer.class.isAssignableFrom(innerClass) + if (!Modifier.isAbstract(innerClass.getModifiers()) + && (JsonSerializer.class.isAssignableFrom(innerClass) || JsonDeserializer.class.isAssignableFrom(innerClass))) { try { addJsonBean(innerClass.newInstance()); diff --git a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index e161ee9357..5b2923fd8e 100644 --- a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -987,7 +987,7 @@ public class SpringApplicationTests { public void run() { SpringApplication application = new SpringApplication( FailingConfig.class); - application.setWebEnvironment(false); + application.setWebApplicationType(WebApplicationType.NONE); application.run(); }; }; diff --git a/spring-boot/src/test/java/org/springframework/boot/cloud/CloudPlatformTests.java b/spring-boot/src/test/java/org/springframework/boot/cloud/CloudPlatformTests.java index aa3210faaa..a5bc6c84e0 100644 --- a/spring-boot/src/test/java/org/springframework/boot/cloud/CloudPlatformTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/cloud/CloudPlatformTests.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. @@ -73,7 +73,8 @@ public class CloudPlatformTests { @Test public void getActiveWhenHasHcLandscapeShouldReturnHcp() throws Exception { - Environment environment = new MockEnvironment().withProperty("HC_LANDSCAPE", "---"); + Environment environment = new MockEnvironment().withProperty("HC_LANDSCAPE", + "---"); CloudPlatform platform = CloudPlatform.getActive(environment); assertThat(platform).isEqualTo(CloudPlatform.HCP); assertThat(platform.isActive(environment)).isTrue(); diff --git a/spring-boot/src/test/java/org/springframework/boot/jackson/JsonComponentModuleTests.java b/spring-boot/src/test/java/org/springframework/boot/jackson/JsonComponentModuleTests.java index 3f65dd9a20..ee42dec511 100644 --- a/spring-boot/src/test/java/org/springframework/boot/jackson/JsonComponentModuleTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/jackson/JsonComponentModuleTests.java @@ -109,7 +109,8 @@ public class JsonComponentModuleTests { @JsonComponent static class ComponentWithInnerAbstractClass { - private static abstract class AbstractSerializer extends NameAndAgeJsonComponent.Serializer { + private static abstract class AbstractSerializer + extends NameAndAgeJsonComponent.Serializer { }