Search in sources :

Example 11 with FailureAnalysis

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;
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis)

Example 12 with FailureAnalysis

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"));
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) Test(org.junit.Test)

Example 13 with FailureAnalysis

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);
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) Test(org.junit.Test)

Example 14 with 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);
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) Test(org.junit.Test)

Example 15 with 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);
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) Test(org.junit.Test)

Aggregations

FailureAnalysis (org.springframework.boot.diagnostics.FailureAnalysis)33 Test (org.junit.Test)27 JCacheNotFoundException (com.giffing.bucket4j.spring.boot.starter.exception.JCacheNotFoundException)1 MissingKeyFilterExpressionException (com.giffing.bucket4j.spring.boot.starter.exception.MissingKeyFilterExpressionException)1 ArrayList (java.util.ArrayList)1 ErrorMessage (org.modelmapper.spi.ErrorMessage)1 FatalBeanException (org.springframework.beans.FatalBeanException)1 InjectionPoint (org.springframework.beans.factory.InjectionPoint)1 NoUniqueBeanDefinitionException (org.springframework.beans.factory.NoUniqueBeanDefinitionException)1 TestBeanConsumer (org.springframework.boot.diagnostics.analyzer.nounique.TestBeanConsumer)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1 FieldError (org.springframework.validation.FieldError)1 ObjectError (org.springframework.validation.ObjectError)1