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:'");
}
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");
}
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");
}
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");
}
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'");
}
Aggregations