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 bcca1fa92a..6b9078875e 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 @@ -62,8 +62,7 @@ public class ElasticsearchAutoConfigurationTests { PropertyPlaceholderAutoConfiguration.class, ElasticsearchAutoConfiguration.class); this.context.refresh(); - assertThat(this.context.getBeanNamesForType(Client.class).length) - .isEqualTo(1); + assertThat(this.context.getBeanNamesForType(Client.class).length).isEqualTo(1); assertThat(this.context.getBean("myClient")) .isSameAs(this.context.getBean(Client.class)); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java index 4b0f061d38..27b26346ba 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java @@ -63,8 +63,8 @@ public class Neo4jDataAutoConfigurationTests { public void defaultConfiguration() { this.context.withPropertyValues("spring.data.neo4j.uri=http://localhost:8989") .run((loaded) -> { - assertThat(loaded).hasSingleBean( - org.neo4j.ogm.config.Configuration.class); + assertThat(loaded) + .hasSingleBean(org.neo4j.ogm.config.Configuration.class); assertThat(loaded).hasSingleBean(SessionFactory.class); assertThat(loaded).hasSingleBean(Neo4jTransactionManager.class); assertThat(loaded).hasSingleBean(OpenSessionInViewInterceptor.class); @@ -73,13 +73,15 @@ public class Neo4jDataAutoConfigurationTests { @Test public void customNeo4jTransactionManagerUsingProperties() { - this.context.withPropertyValues("spring.transaction.default-timeout=30", - "spring.transaction.rollback-on-commit-failure:true").run((loaded) -> { - Neo4jTransactionManager transactionManager = loaded - .getBean(Neo4jTransactionManager.class); - assertThat(transactionManager.getDefaultTimeout()).isEqualTo(30); - assertThat(transactionManager.isRollbackOnCommitFailure()).isTrue(); - }); + this.context + .withPropertyValues("spring.transaction.default-timeout=30", + "spring.transaction.rollback-on-commit-failure:true") + .run((loaded) -> { + Neo4jTransactionManager transactionManager = loaded + .getBean(Neo4jTransactionManager.class); + assertThat(transactionManager.getDefaultTimeout()).isEqualTo(30); + assertThat(transactionManager.isRollbackOnCommitFailure()).isTrue(); + }); } @Test @@ -121,8 +123,8 @@ public class Neo4jDataAutoConfigurationTests { @Test public void openSessionInViewInterceptorCanBeDisabled() { this.context.withPropertyValues("spring.data.neo4j.open-in-view:false") - .run((loaded) -> assertThat(loaded).doesNotHaveBean( - OpenSessionInViewInterceptor.class)); + .run((loaded) -> assertThat(loaded) + .doesNotHaveBean(OpenSessionInViewInterceptor.class)); } @Test @@ -130,7 +132,8 @@ public class Neo4jDataAutoConfigurationTests { this.context.withUserConfiguration(EventListenerConfiguration.class) .run((loaded) -> { Session session = loaded.getBean(SessionFactory.class).openSession(); - session.notifyListeners(new PersistenceEvent(null, Event.TYPE.PRE_SAVE)); + session.notifyListeners( + new PersistenceEvent(null, Event.TYPE.PRE_SAVE)); verify(loaded.getBean("eventListenerOne", EventListener.class)) .onPreSave(any(Event.class)); verify(loaded.getBean("eventListenerTwo", EventListener.class)) diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java index 9989fe1dc9..f62c7e635d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java @@ -123,7 +123,7 @@ public class HazelcastAutoConfigurationClientTests { } private Condition nameStartingWith(String prefix) { - return new Condition((o) -> o.getName().startsWith(prefix), + return new Condition<>((o) -> o.getName().startsWith(prefix), "Name starts with " + prefix); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/influx/InfluxDbAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/influx/InfluxDbAutoConfigurationTests.java index fa5cdfc538..553af58d4d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/influx/InfluxDbAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/influx/InfluxDbAutoConfigurationTests.java @@ -46,16 +46,17 @@ public class InfluxDbAutoConfigurationTests { @Test public void influxDbRequiresUrl() { - this.context.run((loaded) -> - assertThat(loaded.getBeansOfType(InfluxDB.class)).isEmpty()); + this.context.run( + (loaded) -> assertThat(loaded.getBeansOfType(InfluxDB.class)).isEmpty()); } @Test public void influxDbCanBeCustomized() { - this.context.withPropertyValues("spring.influx.url=http://localhost", - "spring.influx.password:password", "spring.influx.user:user") - .run((loaded -> - assertThat(loaded.getBeansOfType(InfluxDB.class)).hasSize(1))); + this.context + .withPropertyValues("spring.influx.url=http://localhost", + "spring.influx.password:password", "spring.influx.user:user") + .run((loaded -> assertThat(loaded.getBeansOfType(InfluxDB.class)) + .hasSize(1))); } @Test @@ -71,11 +72,12 @@ public class InfluxDbAutoConfigurationTests { @Test public void influxDbWithoutCredentialsAndOkHttpClientBuilder() { this.context.withUserConfiguration(CustomOkHttpClientBuilderConfig.class) - .withPropertyValues("spring.influx.url=http://localhost").run((loaded) -> { - assertThat(loaded.getBeansOfType(InfluxDB.class)).hasSize(1); - int readTimeout = getReadTimeoutProperty(loaded); - assertThat(readTimeout).isEqualTo(30_000); - }); + .withPropertyValues("spring.influx.url=http://localhost") + .run((loaded) -> { + assertThat(loaded.getBeansOfType(InfluxDB.class)).hasSize(1); + int readTimeout = getReadTimeoutProperty(loaded); + assertThat(readTimeout).isEqualTo(30_000); + }); } @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 d601c1c590..2e1743e547 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 @@ -126,8 +126,7 @@ public class KafkaAutoConfigurationTests { public void producerProperties() { load("spring.kafka.clientId=cid", "spring.kafka.properties.foo.bar.baz=qux.fiz.buz", - "spring.kafka.producer.acks=all", - "spring.kafka.producer.batch-size=20", + "spring.kafka.producer.acks=all", "spring.kafka.producer.batch-size=20", "spring.kafka.producer.bootstrap-servers=bar:1234", // test override "spring.kafka.producer.buffer-memory=12345", "spring.kafka.producer.compression-type=gzip", diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java index 2f37ba51d5..bb3f079ee5 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java @@ -87,8 +87,7 @@ public class RemoteClientConfigurationTests { @Test public void warnIfRestartDisabled() throws Exception { configure("spring.devtools.remote.restart.enabled:false"); - assertThat(this.output.toString()) - .contains("Remote restart is disabled"); + assertThat(this.output.toString()).contains("Remote restart is disabled"); } @Test diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertProviderApplicationContextInvocationHandler.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertProviderApplicationContextInvocationHandler.java index 64feba0fc2..0519c7de30 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertProviderApplicationContextInvocationHandler.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertProviderApplicationContextInvocationHandler.java @@ -134,8 +134,8 @@ class AssertProviderApplicationContextInvocationHandler implements InvocationHan } private Object getAssertThat(Object proxy) { - return new ApplicationContextAssert( - (ApplicationContext) proxy, this.startupFailure); + return new ApplicationContextAssert<>((ApplicationContext) proxy, + this.startupFailure); } private boolean isCloseMethod(Method method) { diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/HidePackagesClassLoader.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/HidePackagesClassLoader.java index 71d9966ee2..7634331f37 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/HidePackagesClassLoader.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/HidePackagesClassLoader.java @@ -20,8 +20,8 @@ import java.net.URL; import java.net.URLClassLoader; /** - * Test {@link URLClassLoader} that hides configurable packages. No class - * in one of those packages or sub-packages are visible. + * Test {@link URLClassLoader} that hides configurable packages. No class in one of those + * packages or sub-packages are visible. * * @author Andy Wilkinson * @author Stephane Nicoll diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandler.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandler.java index 709608b4a5..a22ff5a0f2 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandler.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandler.java @@ -53,7 +53,8 @@ public class NoUnboundElementsBindHandler extends AbstractBindHandler { this(parent, (configurationPropertySource) -> true); } - public NoUnboundElementsBindHandler(BindHandler parent, Function filter) { + public NoUnboundElementsBindHandler(BindHandler parent, + Function filter) { super(parent); this.filter = filter; } @@ -77,7 +78,8 @@ public class NoUnboundElementsBindHandler extends AbstractBindHandler { BindContext context) { Set unbound = new TreeSet<>(); for (ConfigurationPropertySource source : context.getSources()) { - if (source instanceof IterableConfigurationPropertySource && this.filter.apply(source)) { + if (source instanceof IterableConfigurationPropertySource + && this.filter.apply(source)) { collectUnbound(name, unbound, (IterableConfigurationPropertySource) source); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilter.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilter.java index 4cf647022a..2a0955c735 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilter.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilter.java @@ -26,19 +26,21 @@ import org.springframework.core.env.PropertySource; import org.springframework.core.env.StandardEnvironment; /** - * Function used to determine if a {@link ConfigurationPropertySource} should be - * included when determining unbound elements. If the underlying {@link PropertySource} - * is a systemEnvironment or systemProperties property source, it will not be considered - * for unbound element failures. + * Function used to determine if a {@link ConfigurationPropertySource} should be included + * when determining unbound elements. If the underlying {@link PropertySource} is a + * systemEnvironment or systemProperties property source, it will not be considered for + * unbound element failures. * * @author Madhura Bhave * @since 2.0.0 */ -public class UnboundElementsSourceFilter implements Function { +public class UnboundElementsSourceFilter + implements Function { - private static final Set BENIGN_PROPERTY_SOURCE_NAMES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( - StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, - StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME))); + private static final Set BENIGN_PROPERTY_SOURCE_NAMES = Collections + .unmodifiableSet(new HashSet<>(Arrays.asList( + StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, + StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME))); @Override public Boolean apply(ConfigurationPropertySource configurationPropertySource) { @@ -52,4 +54,3 @@ public class UnboundElementsSourceFilter implements Function getServerCustomizers() { diff --git a/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java b/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java index 281079d216..046631c913 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java @@ -117,7 +117,8 @@ public class UndertowReactiveWebServerFactory extends AbstractReactiveWebServerF /** * Set {@link UndertowBuilderCustomizer}s that should be applied to the Undertow - * {@link Undertow.Builder}. Calling this method will replace any existing customizers. + * {@link Undertow.Builder}. Calling this method will replace any existing + * customizers. * @param customizers the customizers to set */ public void setBuilderCustomizers( diff --git a/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java b/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java index 1d231f8513..d21cf08797 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java @@ -482,7 +482,7 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac File docBase = getCanonicalDocumentRoot(root); List metaInfResourceUrls = getUrlsOfJarsWithMetaInfResources(); List resourceJarUrls = new ArrayList<>(); - List resourceManagers = new ArrayList(); + List resourceManagers = new ArrayList<>(); ResourceManager rootResourceManager = docBase.isDirectory() ? new FileResourceManager(docBase, 0) : new JarResourceManager(docBase); resourceManagers.add(root == null ? rootResourceManager diff --git a/spring-boot/src/test/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilterTests.java b/spring-boot/src/test/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilterTests.java index ee4af02fcd..8fddf0d2ce 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilterTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilterTests.java @@ -44,15 +44,19 @@ public class UnboundElementsSourceFilterTests { } @Test - public void filterWhenSourceIsSystemEnvironmentPropertySourceShouldReturnFalse() throws Exception { - MockPropertySource propertySource = new MockPropertySource(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME); + public void filterWhenSourceIsSystemEnvironmentPropertySourceShouldReturnFalse() + throws Exception { + MockPropertySource propertySource = new MockPropertySource( + StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME); given(this.source.getUnderlyingSource()).willReturn(propertySource); assertThat(this.filter.apply(this.source)).isFalse(); } @Test - public void filterWhenSourceIsSystemPropertiesPropertySourceShouldReturnTrue() throws Exception { - MockPropertySource propertySource = new MockPropertySource(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME); + public void filterWhenSourceIsSystemPropertiesPropertySourceShouldReturnTrue() + throws Exception { + MockPropertySource propertySource = new MockPropertySource( + StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME); given(this.source.getUnderlyingSource()).willReturn(propertySource); assertThat(this.filter.apply(this.source)).isFalse(); }