Improve the type-safety of ContextLoader for servlet and reactive web

This commit is contained in:
Andy Wilkinson
2017-07-02 15:08:09 +01:00
committed by Stephane Nicoll
parent 19ddfad63e
commit dd0ce54425
18 changed files with 1238 additions and 958 deletions

View File

@@ -58,6 +58,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.ContextConsumer;
import org.springframework.boot.test.context.ContextLoader;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.cassandra.core.CassandraOperations;
@@ -79,8 +80,9 @@ import static org.mockito.Mockito.mock;
*/
public class HealthIndicatorAutoConfigurationTests {
public final ContextLoader contextLoader = new ContextLoader().autoConfig(
HealthIndicatorAutoConfiguration.class, ManagementServerProperties.class);
public final ContextLoader<AnnotationConfigApplicationContext> contextLoader = ContextLoader
.standard().autoConfig(HealthIndicatorAutoConfiguration.class,
ManagementServerProperties.class);
@Test
public void defaultHealthIndicator() {
@@ -378,7 +380,7 @@ public class HealthIndicatorAutoConfigurationTests {
.load(hasSingleHealthIndicator(ApplicationHealthIndicator.class));
}
private ContextConsumer hasSingleHealthIndicator(
private ContextConsumer<AnnotationConfigApplicationContext> hasSingleHealthIndicator(
Class<? extends HealthIndicator> type) {
return context -> {
Map<String, HealthIndicator> beans = context