use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoSuchBeanDefinitionFailureAnalyzerTests method failureAnalysisForMissingBeanName.
@Test
public void failureAnalysisForMissingBeanName() {
FailureAnalysis analysis = analyzeFailure(createFailure(StringMissingBeanNameConfiguration.class));
assertThat(analysis.getDescription()).startsWith(String.format("Constructor in %s required a bean named '%s' that could not be found", StringNameHandler.class.getName(), "test-string"));
assertBeanMethodDisabled(analysis, "@ConditionalOnBean (types: java.lang.Integer; SearchStrategy: all) did not find any beans", TestMissingBeanAutoConfiguration.class, "string");
assertActionMissingName(analysis, "test-string");
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoSuchBeanDefinitionFailureAnalyzerTests method failureAnalysisForMissingClassOnAutoConfigurationType.
@Test
public void failureAnalysisForMissingClassOnAutoConfigurationType() {
FailureAnalysis analysis = analyzeFailure(createFailure(MissingClassOnAutoConfigurationConfiguration.class));
assertDescriptionConstructorMissingType(analysis, StringHandler.class, 0, String.class);
assertClassDisabled(analysis, "did not find required class 'com.example.FooBar'", "string");
assertActionMissingType(analysis, String.class);
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoSuchBeanDefinitionFailureAnalyzerTests method failureAnalysisForMultipleBeans.
@Test
public void failureAnalysisForMultipleBeans() {
FailureAnalysis analysis = analyzeFailure(new NoUniqueBeanDefinitionException(String.class, 2, "Test"));
assertThat(analysis).isNull();
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoSuchBeanDefinitionFailureAnalyzerTests method failureAnalysisForNoMatchName.
@Test
public void failureAnalysisForNoMatchName() {
FailureAnalysis analysis = analyzeFailure(createFailure(StringNameHandler.class));
assertThat(analysis.getDescription()).startsWith(String.format("Constructor in %s required a bean named '%s' that could not be found", StringNameHandler.class.getName(), "test-string"));
assertThat(analysis.getDescription().contains("No matching auto-configuration has been found for this bean name."));
assertThat(analysis.getAction()).startsWith(String.format("Consider defining a bean named '%s' in your configuration.", "test-string"));
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoSuchBeanDefinitionFailureAnalyzerTests method failureAnalysisForMissingCollectionType.
@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);
}
Aggregations