ConfigDataNotFoundFailureAnalyzerTests Class — spring-boot Architecture
Architecture documentation for the ConfigDataNotFoundFailureAnalyzerTests class in ConfigDataNotFoundFailureAnalyzerTests.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataNotFoundFailureAnalyzerTests.java lines 32–122
class ConfigDataNotFoundFailureAnalyzerTests {
private final ConfigDataNotFoundFailureAnalyzer analyzer = new ConfigDataNotFoundFailureAnalyzer();
@Test
void analyzeWhenConfigDataLocationNotFoundException() {
ConfigDataLocation location = ConfigDataLocation.of("test");
ConfigDataLocationNotFoundException exception = new ConfigDataLocationNotFoundException(location);
FailureAnalysis result = this.analyzer.analyze(exception);
assertThat(result).isNotNull();
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:'");
}
@Test
void analyzeWhenOptionalConfigDataLocationNotFoundException() {
ConfigDataLocation location = ConfigDataLocation.of("optional:test");
ConfigDataLocationNotFoundException exception = new ConfigDataLocationNotFoundException(location);
FailureAnalysis result = this.analyzer.analyze(exception);
assertThat(result).isNotNull();
assertThat(result.getDescription()).isEqualTo("Config data location 'optional:test' does not exist");
assertThat(result.getAction()).isEqualTo("Check that the value 'optional:test' is correct");
}
@Test
void analyzeWhenConfigDataLocationWithOriginNotFoundException() {
ConfigDataLocation location = ConfigDataLocation.of("test").withOrigin(new TestOrigin("origin"));
ConfigDataLocationNotFoundException exception = new ConfigDataLocationNotFoundException(location);
FailureAnalysis result = this.analyzer.analyze(exception);
assertThat(result).isNotNull();
assertThat(result.getDescription()).isEqualTo("Config data location 'test' does not exist");
assertThat(result.getAction())
.isEqualTo("Check that the value 'test' at origin is correct, or prefix it with 'optional:'");
}
@Test
void analyzeWhenConfigDataResourceNotFoundException() {
ConfigDataResource resource = new TestConfigDataResource("myresource");
ConfigDataResourceNotFoundException exception = new ConfigDataResourceNotFoundException(resource);
FailureAnalysis result = this.analyzer.analyze(exception);
assertThat(result).isNotNull();
assertThat(result.getDescription()).isEqualTo("Config data resource 'myresource' does not exist");
assertThat(result.getAction()).isEqualTo("Check that the value is correct");
}
@Test
void analyzeWhenConfigDataResourceWithLocationNotFoundException() {
ConfigDataLocation location = ConfigDataLocation.of("test");
ConfigDataResource resource = new TestConfigDataResource("myresource");
ConfigDataResourceNotFoundException exception = new ConfigDataResourceNotFoundException(resource)
.withLocation(location);
FailureAnalysis result = this.analyzer.analyze(exception);
assertThat(result).isNotNull();
assertThat(result.getDescription())
.isEqualTo("Config data resource 'myresource' via location 'test' does not exist");
assertThat(result.getAction())
.isEqualTo("Check that the value 'test' is correct, or prefix it with 'optional:'");
}
static class TestOrigin implements Origin {
private final String string;
TestOrigin(String string) {
this.string = string;
}
@Override
public String toString() {
return this.string;
}
}
static class TestConfigDataResource extends ConfigDataResource {
private final String string;
TestConfigDataResource(String string) {
this.string = string;
}
@Override
public String toString() {
return this.string;
}
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free