diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfigurationTests.java index 0fd938278f..a8aa2b40f9 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfigurationTests.java @@ -80,18 +80,16 @@ public class WebEndpointAutoConfigurationTests { @Test public void webApplicationConfiguresExposeExcludePropertyEndpointFilter() { - this.contextRunner.run((context) -> { - assertThat(context).getBeans(ExposeExcludePropertyEndpointFilter.class) - .containsKeys("webIncludeExcludePropertyEndpointFilter", - "controllerIncludeExcludePropertyEndpointFilter"); - }); + this.contextRunner.run((context) -> assertThat(context) + .getBeans(ExposeExcludePropertyEndpointFilter.class) + .containsKeys("webIncludeExcludePropertyEndpointFilter", + "controllerIncludeExcludePropertyEndpointFilter")); } @Test public void contextShouldConfigureServletEndpointDiscoverer() { - this.contextRunner.run((context) -> { - assertThat(context).hasSingleBean(ServletEndpointDiscoverer.class); - }); + this.contextRunner.run((context) -> assertThat(context) + .hasSingleBean(ServletEndpointDiscoverer.class)); } @Test diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java index ac3c8fae3a..72878a1f16 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java @@ -52,9 +52,8 @@ public class ServletEndpointRegistrar implements ServletContextInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { - this.servletEndpoints.forEach((servletEndpoint) -> { - register(servletContext, servletEndpoint); - }); + this.servletEndpoints + .forEach((servletEndpoint) -> register(servletContext, servletEndpoint)); } private void register(ServletContext servletContext, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java index 4e8152d1e4..a4d8dbee7f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java @@ -160,11 +160,9 @@ public class RedisAutoConfigurationTests { .withPropertyValues("spring.redis.sentinel.master:mymaster", "spring.redis.sentinel.nodes:" + StringUtils.collectionToCommaDelimitedString(sentinels)) - .run((context) -> { - assertThat(context.getBean(LettuceConnectionFactory.class) - .isRedisSentinelAware()).isTrue(); - - }); + .run((context) -> assertThat(context + .getBean(LettuceConnectionFactory.class).isRedisSentinelAware()) + .isTrue()); } @Test @@ -192,11 +190,9 @@ public class RedisAutoConfigurationTests { .withPropertyValues( "spring.redis.cluster.nodes[0]:" + clusterNodes.get(0), "spring.redis.cluster.nodes[1]:" + clusterNodes.get(1)) - .run((context) -> { - assertThat(context.getBean(LettuceConnectionFactory.class) - .getClusterConnection()).isNotNull(); - - }); + .run((context) -> assertThat(context + .getBean(LettuceConnectionFactory.class).getClusterConnection()) + .isNotNull()); } @Test @@ -206,12 +202,11 @@ public class RedisAutoConfigurationTests { .withPropertyValues("spring.redis.password=password", "spring.redis.cluster.nodes[0]:" + clusterNodes.get(0), "spring.redis.cluster.nodes[1]:" + clusterNodes.get(1)) - .run((context) -> { - assertThat( - context.getBean(LettuceConnectionFactory.class).getPassword()) - .isEqualTo("password"); + .run((context) -> assertThat( + context.getBean(LettuceConnectionFactory.class).getPassword()) + .isEqualTo("password") - }); + ); } private LettucePoolingClientConfiguration getPoolingClientConfiguration( diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfigurationTests.java index b1e9d8199d..533599e9d3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfigurationTests.java @@ -74,9 +74,9 @@ public class JestAutoConfigurationTests { @Test public void jestClientOnLocalhostByDefault() { - this.contextRunner.run((context) -> { - assertThat(context.getBeansOfType(JestClient.class)).hasSize(1); - }); + this.contextRunner + .run((context) -> assertThat(context.getBeansOfType(JestClient.class)) + .hasSize(1)); } @Test @@ -84,9 +84,8 @@ public class JestAutoConfigurationTests { this.contextRunner.withUserConfiguration(CustomJestClient.class) .withPropertyValues( "spring.elasticsearch.jest.uris[0]=http://localhost:9200") - .run((context) -> { - assertThat(context.getBeansOfType(JestClient.class)).hasSize(1); - }); + .run((context) -> assertThat(context.getBeansOfType(JestClient.class)) + .hasSize(1)); } @Test @@ -120,11 +119,9 @@ public class JestAutoConfigurationTests { .withPropertyValues( "spring.elasticsearch.jest.uris=http://localhost:9200", "spring.elasticsearch.jest.proxy.host=proxy.example.com") - .run((context) -> { - assertThat(context.getStartupFailure()) - .isInstanceOf(BeanCreationException.class) - .hasMessageContaining("Proxy port must not be null"); - }); + .run((context) -> assertThat(context.getStartupFailure()) + .isInstanceOf(BeanCreationException.class) + .hasMessageContaining("Proxy port must not be null")); } @Test diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfigurationTests.java index 68b297d3e9..f23af95fb1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfigurationTests.java @@ -44,9 +44,9 @@ public class ProjectInfoAutoConfigurationTests { @Test public void gitPropertiesUnavailableIfResourceNotAvailable() { - this.contextRunner.run((context) -> { - assertThat(context.getBeansOfType(GitProperties.class)).isEmpty(); - }); + this.contextRunner + .run((context) -> assertThat(context.getBeansOfType(GitProperties.class)) + .isEmpty()); } @Test @@ -107,9 +107,8 @@ public class ProjectInfoAutoConfigurationTests { this.contextRunner .withPropertyValues("spring.info.build.location=" + "classpath:/org/acme/no-build-info.properties") - .run((context) -> { - assertThat(context.getBeansOfType(BuildProperties.class)).hasSize(0); - }); + .run((context) -> assertThat( + context.getBeansOfType(BuildProperties.class)).hasSize(0)); } @Test diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java index 7acce14c41..c316614f67 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java @@ -66,9 +66,9 @@ public class JooqAutoConfigurationTests { @Test public void noDataSource() { - this.contextRunner.run((context) -> { - assertThat(context.getBeansOfType(DSLContext.class)).isEmpty(); - }); + this.contextRunner + .run((context) -> assertThat(context.getBeansOfType(DSLContext.class)) + .isEmpty()); } @Test @@ -151,10 +151,10 @@ public class JooqAutoConfigurationTests { @Test public void relaxedBindingOfSqlDialect() { this.contextRunner.withUserConfiguration(JooqDataSourceConfiguration.class) - .withPropertyValues("spring.jooq.sql-dialect:PoSTGrES").run((context) -> { - assertThat(context.getBean(org.jooq.Configuration.class).dialect()) - .isEqualTo(SQLDialect.POSTGRES); - }); + .withPropertyValues("spring.jooq.sql-dialect:PoSTGrES") + .run((context) -> assertThat( + context.getBean(org.jooq.Configuration.class).dialect()) + .isEqualTo(SQLDialect.POSTGRES)); } private static class AssertFetch implements TransactionalRunnable { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java index 02cc49d197..1cbd52e07e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java @@ -39,7 +39,7 @@ public class LdapAutoConfigurationTests { @Test public void contextSourceWithDefaultUrl() { - this.contextRunner.run(context -> { + this.contextRunner.run((context) -> { LdapContextSource contextSource = context.getBean(LdapContextSource.class); String[] urls = (String[]) ReflectionTestUtils.getField(contextSource, "urls"); @@ -51,7 +51,7 @@ public class LdapAutoConfigurationTests { @Test public void contextSourceWithSingleUrl() { this.contextRunner.withPropertyValues("spring.ldap.urls:ldap://localhost:123") - .run(context -> { + .run((context) -> { ContextSource contextSource = context.getBean(ContextSource.class); String[] urls = (String[]) ReflectionTestUtils.getField(contextSource, "urls"); @@ -64,7 +64,7 @@ public class LdapAutoConfigurationTests { this.contextRunner .withPropertyValues( "spring.ldap.urls:ldap://localhost:123,ldap://mycompany:123") - .run(context -> { + .run((context) -> { ContextSource contextSource = context.getBean(ContextSource.class); LdapProperties ldapProperties = context.getBean(LdapProperties.class); String[] urls = (String[]) ReflectionTestUtils.getField(contextSource, @@ -83,7 +83,7 @@ public class LdapAutoConfigurationTests { "spring.ldap.anonymous-read-only:true", "spring.ldap.base:cn=SpringDevelopers", "spring.ldap.baseEnvironment.java.naming.security.authentication:DIGEST-MD5") - .run(context -> { + .run((context) -> { LdapContextSource contextSource = context .getBean(LdapContextSource.class); assertThat(contextSource.getUserDn()).isEqualTo("root"); diff --git a/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java b/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java index 160694124e..234cb9a021 100644 --- a/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java +++ b/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java @@ -75,7 +75,7 @@ class PropertiesMigrationReport { report.append(String.format("%nThe use of configuration keys that are no longer " + "supported was found in the environment:%n%n")); append(report, content, - metadata -> "Reason: " + (metadata) -> "Reason: " + (StringUtils.hasText(metadata.getDeprecation().getReason()) ? metadata.getDeprecation().getReason() : "none")); report.append(String.format("%n"));