use of org.springframework.boot.diagnostics.FailureAnalysis in project microservices by pwillhan.
the class ModelMapConfigurationFailureAnalyzer method analyze.
@Override
protected FailureAnalysis analyze(Throwable rootFailure, ConfigurationException cause) {
StringBuilder description = new StringBuilder();
description.append("ModelMapper configuration failed:\n");
for (ErrorMessage message : cause.getErrorMessages()) {
description.append(message.getMessage());
}
return new FailureAnalysis(description.toString(), "Fix ModelMapper configuration", cause);
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoSuchBeanDefinitionFailureAnalyzerTests method failureAnalysisForSeveralConditionsType.
@Test
void failureAnalysisForSeveralConditionsType() {
FailureAnalysis analysis = analyzeFailure(createFailure(SeveralAutoConfigurationTypeConfiguration.class));
assertDescriptionConstructorMissingType(analysis, StringHandler.class, 0, String.class);
assertBeanMethodDisabled(analysis, "did not find property 'spring.string.enabled'", TestPropertyAutoConfiguration.class, "string");
assertClassDisabled(analysis, "did not find required class 'com.example.FooBar'", "string", ClassUtils.getShortName(TestPropertyAutoConfiguration.class));
assertActionMissingType(analysis, String.class);
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoSuchBeanDefinitionFailureAnalyzerTests method failureAnalysisForMissingClassOnAutoConfigurationType.
@Test
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", ClassUtils.getShortName(TestTypeClassAutoConfiguration.class));
assertActionMissingType(analysis, String.class);
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoSuchBeanDefinitionFailureAnalyzerTests method failureAnalysisForMissingBeanName.
@Test
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 failureAnalysisForMissingPropertySubType.
@Test
void failureAnalysisForMissingPropertySubType() {
FailureAnalysis analysis = analyzeFailure(createFailure(IntegerPropertyTypeConfiguration.class));
assertThat(analysis).isNotNull();
assertDescriptionConstructorMissingType(analysis, NumberHandler.class, 0, Number.class);
assertBeanMethodDisabled(analysis, "did not find property 'spring.integer.enabled'", TestPropertyAutoConfiguration.class, "integer");
assertActionMissingType(analysis, Number.class);
}
Aggregations