Search in sources :

Example 41 with FailureAnalysis

use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.

the class BindFailureAnalyzerTests method analysisForValidationExceptionIsNull.

@Test
void analysisForValidationExceptionIsNull() {
    FailureAnalysis analysis = performAnalysis(FieldValidationFailureConfiguration.class, "test.foo.value=1");
    assertThat(analysis).isNull();
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) Test(org.junit.jupiter.api.Test)

Example 42 with FailureAnalysis

use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.

the class BindFailureAnalyzerTests method bindExceptionDueToClassNotFoundConvertionFailure.

// gh-27028
@Test
void bindExceptionDueToClassNotFoundConvertionFailure() {
    FailureAnalysis analysis = performAnalysis(GenericFailureConfiguration.class, "test.foo.type=com.example.Missing");
    assertThat(analysis.getDescription()).contains(failure("test.foo.type", "com.example.Missing", "\"test.foo.type\" from property source \"test\"", "failed to convert java.lang.String to java.lang.Class<?> (caused by java.lang.ClassNotFoundException: com.example.Missing"));
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) Test(org.junit.jupiter.api.Test)

Example 43 with FailureAnalysis

use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.

the class BindFailureAnalyzerTests method bindExceptionDueToOtherFailure.

@Test
void bindExceptionDueToOtherFailure() {
    FailureAnalysis analysis = performAnalysis(GenericFailureConfiguration.class, "test.foo.value=alpha");
    assertThat(analysis.getDescription()).contains(failure("test.foo.value", "alpha", "\"test.foo.value\" from property source \"test\"", "failed to convert java.lang.String to int"));
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) Test(org.junit.jupiter.api.Test)

Example 44 with FailureAnalysis

use of org.springframework.boot.diagnostics.FailureAnalysis in project uhgroupings by uhawaii-system-its-ti-iam.

the class ApiServerHandshakeAnalyzerTest method construction.

@Test
public void construction() {
    ApiServerHandshakeAnalyzer analyzer = new ApiServerHandshakeAnalyzer();
    assertNotNull(analyzer);
    FailureAnalysis fa = analyzer.analyze(null, null);
    assertNotNull(fa);
    assertThat(fa.getDescription(), startsWith("Could not connect to the API server"));
    assertThat(fa.getAction(), startsWith("Start the UH Groupings API"));
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) Test(org.junit.Test)

Example 45 with FailureAnalysis

use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-cloud-open-service-broker by spring-cloud.

the class AbstractServiceBrokerWebAutoConfigurationTest method assertFailureAnalysis.

protected void assertFailureAnalysis(Throwable t) {
    FailureAnalyzer analyzer = new RequiredServiceInstanceServiceBeanFailureAnalyzer();
    FailureAnalysis analysis = analyzer.analyze(t);
    assertThat(analysis).isNotNull();
    assertThat(analysis.getDescription()).isEqualTo(ANALYZER_DESCRIPTION);
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) FailureAnalyzer(org.springframework.boot.diagnostics.FailureAnalyzer)

Aggregations

FailureAnalysis (org.springframework.boot.diagnostics.FailureAnalysis)89 Test (org.junit.jupiter.api.Test)69 Test (org.junit.Test)6 MapPropertySource (org.springframework.core.env.MapPropertySource)6 InvalidConfigurationPropertyValueException (org.springframework.boot.context.properties.source.InvalidConfigurationPropertyValueException)4 MutuallyExclusiveConfigurationPropertiesException (org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException)4 BeanCreationException (org.springframework.beans.factory.BeanCreationException)3 InjectionPoint (org.springframework.beans.factory.InjectionPoint)3 LinkedHashMap (java.util.LinkedHashMap)2 FailureAnalyzer (org.springframework.boot.diagnostics.FailureAnalyzer)2 FieldError (org.springframework.validation.FieldError)2 JCacheNotFoundException (com.giffing.bucket4j.spring.boot.starter.exception.JCacheNotFoundException)1 MissingKeyFilterExpressionException (com.giffing.bucket4j.spring.boot.starter.exception.MissingKeyFilterExpressionException)1 Annotation (java.lang.annotation.Annotation)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ErrorMessage (org.modelmapper.spi.ErrorMessage)1 FatalBeanException (org.springframework.beans.FatalBeanException)1 NoUniqueBeanDefinitionException (org.springframework.beans.factory.NoUniqueBeanDefinitionException)1 LoggingFailureAnalysisReporter (org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter)1