Skip to content

Commit 4c23afd

Browse files
committed
Polish
1 parent e2cb7a7 commit 4c23afd

File tree

8 files changed

+43
-55
lines changed

8 files changed

+43
-55
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfigurationTests.java

+6-8
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,16 @@ public void webApplicationConfiguresEndpointDiscoverer() {
8080

8181
@Test
8282
public void webApplicationConfiguresExposeExcludePropertyEndpointFilter() {
83-
this.contextRunner.run((context) -> {
84-
assertThat(context).getBeans(ExposeExcludePropertyEndpointFilter.class)
85-
.containsKeys("webIncludeExcludePropertyEndpointFilter",
86-
"controllerIncludeExcludePropertyEndpointFilter");
87-
});
83+
this.contextRunner.run((context) -> assertThat(context)
84+
.getBeans(ExposeExcludePropertyEndpointFilter.class)
85+
.containsKeys("webIncludeExcludePropertyEndpointFilter",
86+
"controllerIncludeExcludePropertyEndpointFilter"));
8887
}
8988

9089
@Test
9190
public void contextShouldConfigureServletEndpointDiscoverer() {
92-
this.contextRunner.run((context) -> {
93-
assertThat(context).hasSingleBean(ServletEndpointDiscoverer.class);
94-
});
91+
this.contextRunner.run((context) -> assertThat(context)
92+
.hasSingleBean(ServletEndpointDiscoverer.class));
9593
}
9694

9795
@Test

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ public ServletEndpointRegistrar(String basePath,
5252

5353
@Override
5454
public void onStartup(ServletContext servletContext) throws ServletException {
55-
this.servletEndpoints.forEach((servletEndpoint) -> {
56-
register(servletContext, servletEndpoint);
57-
});
55+
this.servletEndpoints
56+
.forEach((servletEndpoint) -> register(servletContext, servletEndpoint));
5857
}
5958

6059
private void register(ServletContext servletContext,

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java

+10-15
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,9 @@ public void testRedisConfigurationWithSentinel() {
160160
.withPropertyValues("spring.redis.sentinel.master:mymaster",
161161
"spring.redis.sentinel.nodes:"
162162
+ StringUtils.collectionToCommaDelimitedString(sentinels))
163-
.run((context) -> {
164-
assertThat(context.getBean(LettuceConnectionFactory.class)
165-
.isRedisSentinelAware()).isTrue();
166-
167-
});
163+
.run((context) -> assertThat(context
164+
.getBean(LettuceConnectionFactory.class).isRedisSentinelAware())
165+
.isTrue());
168166
}
169167

170168
@Test
@@ -192,11 +190,9 @@ public void testRedisConfigurationWithCluster() {
192190
.withPropertyValues(
193191
"spring.redis.cluster.nodes[0]:" + clusterNodes.get(0),
194192
"spring.redis.cluster.nodes[1]:" + clusterNodes.get(1))
195-
.run((context) -> {
196-
assertThat(context.getBean(LettuceConnectionFactory.class)
197-
.getClusterConnection()).isNotNull();
198-
199-
});
193+
.run((context) -> assertThat(context
194+
.getBean(LettuceConnectionFactory.class).getClusterConnection())
195+
.isNotNull());
200196
}
201197

202198
@Test
@@ -206,12 +202,11 @@ public void testRedisConfigurationWithClusterAndPassword() {
206202
.withPropertyValues("spring.redis.password=password",
207203
"spring.redis.cluster.nodes[0]:" + clusterNodes.get(0),
208204
"spring.redis.cluster.nodes[1]:" + clusterNodes.get(1))
209-
.run((context) -> {
210-
assertThat(
211-
context.getBean(LettuceConnectionFactory.class).getPassword())
212-
.isEqualTo("password");
205+
.run((context) -> assertThat(
206+
context.getBean(LettuceConnectionFactory.class).getPassword())
207+
.isEqualTo("password")
213208

214-
});
209+
);
215210
}
216211

217212
private LettucePoolingClientConfiguration getPoolingClientConfiguration(

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfigurationTests.java

+8-11
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,18 @@ public void close() {
7474

7575
@Test
7676
public void jestClientOnLocalhostByDefault() {
77-
this.contextRunner.run((context) -> {
78-
assertThat(context.getBeansOfType(JestClient.class)).hasSize(1);
79-
});
77+
this.contextRunner
78+
.run((context) -> assertThat(context.getBeansOfType(JestClient.class))
79+
.hasSize(1));
8080
}
8181

8282
@Test
8383
public void customJestClient() {
8484
this.contextRunner.withUserConfiguration(CustomJestClient.class)
8585
.withPropertyValues(
8686
"spring.elasticsearch.jest.uris[0]=http://localhost:9200")
87-
.run((context) -> {
88-
assertThat(context.getBeansOfType(JestClient.class)).hasSize(1);
89-
});
87+
.run((context) -> assertThat(context.getBeansOfType(JestClient.class))
88+
.hasSize(1));
9089
}
9190

9291
@Test
@@ -120,11 +119,9 @@ public void proxyHostWithoutPort() {
120119
.withPropertyValues(
121120
"spring.elasticsearch.jest.uris=http://localhost:9200",
122121
"spring.elasticsearch.jest.proxy.host=proxy.example.com")
123-
.run((context) -> {
124-
assertThat(context.getStartupFailure())
125-
.isInstanceOf(BeanCreationException.class)
126-
.hasMessageContaining("Proxy port must not be null");
127-
});
122+
.run((context) -> assertThat(context.getStartupFailure())
123+
.isInstanceOf(BeanCreationException.class)
124+
.hasMessageContaining("Proxy port must not be null"));
128125
}
129126

130127
@Test

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfigurationTests.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public class ProjectInfoAutoConfigurationTests {
4444

4545
@Test
4646
public void gitPropertiesUnavailableIfResourceNotAvailable() {
47-
this.contextRunner.run((context) -> {
48-
assertThat(context.getBeansOfType(GitProperties.class)).isEmpty();
49-
});
47+
this.contextRunner
48+
.run((context) -> assertThat(context.getBeansOfType(GitProperties.class))
49+
.isEmpty());
5050
}
5151

5252
@Test
@@ -107,9 +107,8 @@ public void buildPropertiesCustomInvalidLocation() {
107107
this.contextRunner
108108
.withPropertyValues("spring.info.build.location="
109109
+ "classpath:/org/acme/no-build-info.properties")
110-
.run((context) -> {
111-
assertThat(context.getBeansOfType(BuildProperties.class)).hasSize(0);
112-
});
110+
.run((context) -> assertThat(
111+
context.getBeansOfType(BuildProperties.class)).hasSize(0));
113112
}
114113

115114
@Test

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ public class JooqAutoConfigurationTests {
6666

6767
@Test
6868
public void noDataSource() {
69-
this.contextRunner.run((context) -> {
70-
assertThat(context.getBeansOfType(DSLContext.class)).isEmpty();
71-
});
69+
this.contextRunner
70+
.run((context) -> assertThat(context.getBeansOfType(DSLContext.class))
71+
.isEmpty());
7272
}
7373

7474
@Test
@@ -151,10 +151,10 @@ public void customProvidersArePickedUp() {
151151
@Test
152152
public void relaxedBindingOfSqlDialect() {
153153
this.contextRunner.withUserConfiguration(JooqDataSourceConfiguration.class)
154-
.withPropertyValues("spring.jooq.sql-dialect:PoSTGrES").run((context) -> {
155-
assertThat(context.getBean(org.jooq.Configuration.class).dialect())
156-
.isEqualTo(SQLDialect.POSTGRES);
157-
});
154+
.withPropertyValues("spring.jooq.sql-dialect:PoSTGrES")
155+
.run((context) -> assertThat(
156+
context.getBean(org.jooq.Configuration.class).dialect())
157+
.isEqualTo(SQLDialect.POSTGRES));
158158
}
159159

160160
private static class AssertFetch implements TransactionalRunnable {

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class LdapAutoConfigurationTests {
3939

4040
@Test
4141
public void contextSourceWithDefaultUrl() {
42-
this.contextRunner.run(context -> {
42+
this.contextRunner.run((context) -> {
4343
LdapContextSource contextSource = context.getBean(LdapContextSource.class);
4444
String[] urls = (String[]) ReflectionTestUtils.getField(contextSource,
4545
"urls");
@@ -51,7 +51,7 @@ public void contextSourceWithDefaultUrl() {
5151
@Test
5252
public void contextSourceWithSingleUrl() {
5353
this.contextRunner.withPropertyValues("spring.ldap.urls:ldap://localhost:123")
54-
.run(context -> {
54+
.run((context) -> {
5555
ContextSource contextSource = context.getBean(ContextSource.class);
5656
String[] urls = (String[]) ReflectionTestUtils.getField(contextSource,
5757
"urls");
@@ -64,7 +64,7 @@ public void contextSourceWithSeveralUrls() {
6464
this.contextRunner
6565
.withPropertyValues(
6666
"spring.ldap.urls:ldap://localhost:123,ldap://mycompany:123")
67-
.run(context -> {
67+
.run((context) -> {
6868
ContextSource contextSource = context.getBean(ContextSource.class);
6969
LdapProperties ldapProperties = context.getBean(LdapProperties.class);
7070
String[] urls = (String[]) ReflectionTestUtils.getField(contextSource,
@@ -83,7 +83,7 @@ public void contextSourceWithExtraCustomization() {
8383
"spring.ldap.anonymous-read-only:true",
8484
"spring.ldap.base:cn=SpringDevelopers",
8585
"spring.ldap.baseEnvironment.java.naming.security.authentication:DIGEST-MD5")
86-
.run(context -> {
86+
.run((context) -> {
8787
LdapContextSource contextSource = context
8888
.getBean(LdapContextSource.class);
8989
assertThat(contextSource.getUserDn()).isEqualTo("root");

spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public String getErrorReport() {
7575
report.append(String.format("%nThe use of configuration keys that are no longer "
7676
+ "supported was found in the environment:%n%n"));
7777
append(report, content,
78-
metadata -> "Reason: "
78+
(metadata) -> "Reason: "
7979
+ (StringUtils.hasText(metadata.getDeprecation().getReason())
8080
? metadata.getDeprecation().getReason() : "none"));
8181
report.append(String.format("%n"));

0 commit comments

Comments
 (0)