use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class InvalidConfigurationPropertyNameFailureAnalyzerTests method analysisWhenRootCauseIsBeanCreationFailureShouldContainBeanName.
@Test
void analysisWhenRootCauseIsBeanCreationFailureShouldContainBeanName() {
BeanCreationException failure = createFailure(InvalidPrefixConfiguration.class);
FailureAnalysis analysis = this.analyzer.analyze(failure);
assertThat(analysis.getDescription()).contains(String.format("%n Invalid characters: %s%n Bean: %s%n Reason: %s", "'F', 'P'", "invalidPrefixProperties", "Canonical names should be kebab-case ('-' separated), " + "lowercase alpha-numeric characters and must start with a letter"));
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoUniqueBeanDefinitionFailureAnalyzerTests method failureAnalysisForXmlConsumer.
@Test
void failureAnalysisForXmlConsumer() {
FailureAnalysis failureAnalysis = analyzeFailure(createFailure(XmlConsumer.class));
assertThat(failureAnalysis.getDescription()).startsWith("Parameter 0 of constructor in " + TestBeanConsumer.class.getName() + " required a single bean, but 6 were found:");
assertFoundBeans(failureAnalysis);
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoUniqueBeanDefinitionFailureAnalyzerTests method failureAnalysisForFieldConsumer.
@Test
void failureAnalysisForFieldConsumer() {
FailureAnalysis failureAnalysis = analyzeFailure(createFailure(FieldConsumer.class));
assertThat(failureAnalysis.getDescription()).startsWith("Field testBean in " + FieldConsumer.class.getName() + " required a single bean, but 6 were found:");
assertFoundBeans(failureAnalysis);
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoUniqueBeanDefinitionFailureAnalyzerTests method failureAnalysisForObjectProviderConstructorConsumer.
@Test
void failureAnalysisForObjectProviderConstructorConsumer() {
FailureAnalysis failureAnalysis = analyzeFailure(createFailure(ObjectProviderConstructorConsumer.class));
assertThat(failureAnalysis.getDescription()).startsWith("Constructor in " + ObjectProviderConstructorConsumer.class.getName() + " required a single bean, but 6 were found:");
assertFoundBeans(failureAnalysis);
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class UnboundConfigurationPropertyFailureAnalyzerTests method bindExceptionDueToUnboundElements.
@Test
void bindExceptionDueToUnboundElements() {
FailureAnalysis analysis = performAnalysis(UnboundElementsFailureConfiguration.class, "test.foo.listValue[0]=hello", "test.foo.listValue[2]=world");
assertThat(analysis.getDescription()).contains(failure("test.foo.listvalue[2]", "world", "\"test.foo.listValue[2]\" from property source \"test\"", "The elements [test.foo.listvalue[2]] were left unbound."));
}
Aggregations