use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class BeanNotOfRequiredTypeFailureAnalyzerTests method performAnalysis.
private FailureAnalysis performAnalysis(Class<?> configuration) {
FailureAnalysis analysis = this.analyzer.analyze(createFailure(configuration));
assertThat(analysis).isNotNull();
return analysis;
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class BindFailureAnalyzerTests method bindExceptionWithFieldErrorsDueToValidationFailure.
@Test
public void bindExceptionWithFieldErrorsDueToValidationFailure() {
FailureAnalysis analysis = performAnalysis(FieldValidationFailureConfiguration.class);
assertThat(analysis.getDescription()).contains(failure("test.foo.foo", "null", "may not be null"));
assertThat(analysis.getDescription()).contains(failure("test.foo.value", "0", "at least five"));
assertThat(analysis.getDescription()).contains(failure("test.foo.nested.bar", "null", "may not be null"));
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoUniqueBeanDefinitionFailureAnalyzerTests method failureAnalysisForConstructorConsumer.
@Test
public void failureAnalysisForConstructorConsumer() {
FailureAnalysis failureAnalysis = analyzeFailure(createFailure(ConstructorConsumer.class));
assertThat(failureAnalysis.getDescription()).startsWith("Parameter 0 of constructor in " + ConstructorConsumer.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 failureAnalysisForMethodConsumer.
@Test
public void failureAnalysisForMethodConsumer() {
FailureAnalysis failureAnalysis = analyzeFailure(createFailure(MethodConsumer.class));
assertThat(failureAnalysis.getDescription()).startsWith("Parameter 0 of method consumer in " + MethodConsumer.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 failureAnalysisForObjectProviderMethodConsumer.
@Test
public void failureAnalysisForObjectProviderMethodConsumer() {
FailureAnalysis failureAnalysis = analyzeFailure(createFailure(ObjectProviderMethodConsumer.class));
assertThat(failureAnalysis.getDescription()).startsWith("Method consumer in " + ObjectProviderMethodConsumer.class.getName() + " required a single bean, but 6 were found:");
assertFoundBeans(failureAnalysis);
}
Aggregations