|
|
|
@ -17,7 +17,9 @@
|
|
|
|
|
package org.springframework.boot.autoconfigure.diagnostics.analyzer;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
|
@ -81,6 +83,30 @@ public class NoSuchBeanDefinitionFailureAnalyzerTests {
|
|
|
|
|
assertActionMissingType(analysis, String.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void failureAnalysisForMissingCollectionType() throws Exception {
|
|
|
|
|
FailureAnalysis analysis = analyzeFailure(
|
|
|
|
|
createFailure(StringCollectionConfiguration.class));
|
|
|
|
|
assertDescriptionConstructorMissingType(analysis, StringCollectionHandler.class, 0,
|
|
|
|
|
String.class);
|
|
|
|
|
assertBeanMethodDisabled(analysis,
|
|
|
|
|
"did not find property 'spring.string.enabled'",
|
|
|
|
|
TestPropertyAutoConfiguration.class, "string");
|
|
|
|
|
assertActionMissingType(analysis, String.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void failureAnalysisForMissingMapType() throws Exception {
|
|
|
|
|
FailureAnalysis analysis = analyzeFailure(
|
|
|
|
|
createFailure(StringMapConfiguration.class));
|
|
|
|
|
assertDescriptionConstructorMissingType(analysis, StringMapHandler.class, 0,
|
|
|
|
|
String.class);
|
|
|
|
|
assertBeanMethodDisabled(analysis,
|
|
|
|
|
"did not find property 'spring.string.enabled'",
|
|
|
|
|
TestPropertyAutoConfiguration.class, "string");
|
|
|
|
|
assertActionMissingType(analysis, String.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void failureAnalysisForMissingPropertySubType() {
|
|
|
|
|
FailureAnalysis analysis = analyzeFailure(
|
|
|
|
@ -240,6 +266,20 @@ public class NoSuchBeanDefinitionFailureAnalyzerTests {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
|
@ImportAutoConfiguration(TestPropertyAutoConfiguration.class)
|
|
|
|
|
@Import(StringCollectionHandler.class)
|
|
|
|
|
protected static class StringCollectionConfiguration {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
|
@ImportAutoConfiguration(TestPropertyAutoConfiguration.class)
|
|
|
|
|
@Import(StringMapHandler.class)
|
|
|
|
|
protected static class StringMapConfiguration {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
|
@ImportAutoConfiguration(TestPropertyAutoConfiguration.class)
|
|
|
|
|
@Import(NumberHandler.class)
|
|
|
|
@ -330,4 +370,18 @@ public class NoSuchBeanDefinitionFailureAnalyzerTests {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected static class StringCollectionHandler {
|
|
|
|
|
|
|
|
|
|
public StringCollectionHandler(Collection<String> collection) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected static class StringMapHandler {
|
|
|
|
|
|
|
|
|
|
public StringMapHandler(Map<String, String> map) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|