ConfigTreeConfigDataLoaderTests Class — spring-boot Architecture
Architecture documentation for the ConfigTreeConfigDataLoaderTests class in ConfigTreeConfigDataLoaderTests.java from the spring-boot codebase.
Entity Profile
Source Code
core/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigTreeConfigDataLoaderTests.java lines 40–71
class ConfigTreeConfigDataLoaderTests {
private final ConfigTreeConfigDataLoader loader = new ConfigTreeConfigDataLoader();
private final ConfigDataLoaderContext loaderContext = mock(ConfigDataLoaderContext.class);
@TempDir
@SuppressWarnings("NullAway.Init")
Path directory;
@Test
void loadReturnsConfigDataWithPropertySource() throws IOException {
File file = this.directory.resolve("hello").toFile();
file.getParentFile().mkdirs();
FileCopyUtils.copy("world\n".getBytes(StandardCharsets.UTF_8), file);
ConfigTreeConfigDataResource location = new ConfigTreeConfigDataResource(this.directory.toString());
ConfigData configData = this.loader.load(this.loaderContext, location);
assertThat(configData.getPropertySources()).hasSize(1);
PropertySource<?> source = configData.getPropertySources().get(0);
assertThat(source.getName()).isEqualTo("Config tree '" + this.directory.toString() + "'");
assertThat(source.getProperty("hello")).hasToString("world");
}
@Test
void loadWhenPathDoesNotExistThrowsException() {
File missing = this.directory.resolve("missing").toFile();
ConfigTreeConfigDataResource location = new ConfigTreeConfigDataResource(missing.toString());
assertThatExceptionOfType(ConfigDataResourceNotFoundException.class)
.isThrownBy(() -> this.loader.load(this.loaderContext, location));
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free