Search in sources :

Example 61 with FailureAnalysis

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

the class ConfigDataNotFoundFailureAnalyzerTests method analyzeWhenConfigDataLocationNotFoundException.

@Test
void analyzeWhenConfigDataLocationNotFoundException() {
    ConfigDataLocation location = ConfigDataLocation.of("test");
    ConfigDataLocationNotFoundException exception = new ConfigDataLocationNotFoundException(location);
    FailureAnalysis result = this.analyzer.analyze(exception);
    assertThat(result.getDescription()).isEqualTo("Config data location 'test' does not exist");
    assertThat(result.getAction()).isEqualTo("Check that the value 'test' is correct, or prefix it with 'optional:'");
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) Test(org.junit.jupiter.api.Test)

Example 62 with FailureAnalysis

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

the class ConfigDataNotFoundFailureAnalyzerTests method analyzeWhenConfigDataResourceNotFoundException.

@Test
void analyzeWhenConfigDataResourceNotFoundException() {
    ConfigDataResource resource = new TestConfigDataResource("myresource");
    ConfigDataResourceNotFoundException exception = new ConfigDataResourceNotFoundException(resource);
    FailureAnalysis result = this.analyzer.analyze(exception);
    assertThat(result.getDescription()).isEqualTo("Config data resource 'myresource' does not exist");
    assertThat(result.getAction()).isEqualTo("Check that the value is correct");
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) Test(org.junit.jupiter.api.Test)

Example 63 with FailureAnalysis

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

the class RedisUrlSyntaxFailureAnalyzerTests method analyzeRedisSentinelUrl.

@Test
void analyzeRedisSentinelUrl() {
    RedisUrlSyntaxException exception = new RedisUrlSyntaxException("redis-sentinel://username:password@127.0.0.1:26379,127.0.0.1:26380/mymaster");
    FailureAnalysis analysis = new RedisUrlSyntaxFailureAnalyzer().analyze(exception);
    assertThat(analysis.getDescription()).contains("The URL 'redis-sentinel://username:password@127.0.0.1:26379,127.0.0.1:26380/mymaster' is not valid").contains("The scheme 'redis-sentinel' is not supported");
    assertThat(analysis.getAction()).contains("Use spring.redis.sentinel properties");
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) Test(org.junit.jupiter.api.Test)

Example 64 with FailureAnalysis

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

the class RedisUrlSyntaxFailureAnalyzerTests method analyzeRedisHttpUrl.

@Test
void analyzeRedisHttpUrl() {
    RedisUrlSyntaxException exception = new RedisUrlSyntaxException("http://127.0.0.1:26379/mymaster");
    FailureAnalysis analysis = new RedisUrlSyntaxFailureAnalyzer().analyze(exception);
    assertThat(analysis.getDescription()).contains("The URL 'http://127.0.0.1:26379/mymaster' is not valid").contains("The scheme 'http' is not supported");
    assertThat(analysis.getAction()).contains("Use the scheme 'redis://' for insecure or 'rediss://' for secure");
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) Test(org.junit.jupiter.api.Test)

Example 65 with FailureAnalysis

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

the class RedisUrlSyntaxFailureAnalyzerTests method analyzeInvalidUrlSyntax.

@Test
void analyzeInvalidUrlSyntax() {
    RedisUrlSyntaxException exception = new RedisUrlSyntaxException("redis://invalid");
    FailureAnalysis analysis = new RedisUrlSyntaxFailureAnalyzer().analyze(exception);
    assertThat(analysis.getDescription()).contains("The URL 'redis://invalid' is not valid");
    assertThat(analysis.getAction()).contains("Review the value of the property 'spring.redis.url'");
}
Also used : FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis) Test(org.junit.jupiter.api.Test)

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