pull/11775/head
Andy Wilkinson 7 years ago
parent e2cb7a7545
commit 4c23afdcd8

@ -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

@ -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,

@ -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(

@ -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

@ -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

@ -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 {

@ -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");

@ -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"));

Loading…
Cancel
Save