SystemEnvironmentConfigDataLoaderTests Class — spring-boot Architecture
Architecture documentation for the SystemEnvironmentConfigDataLoaderTests class in SystemEnvironmentConfigDataLoaderTests.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot/src/test/java/org/springframework/boot/context/config/SystemEnvironmentConfigDataLoaderTests.java lines 38–75
class SystemEnvironmentConfigDataLoaderTests {
private ConfigDataLoaderContext context;
private Map<String, String> environment;
private SystemEnvironmentConfigDataLoader loader;
@BeforeEach
void setUp() {
this.context = mock(ConfigDataLoaderContext.class);
this.environment = new HashMap<>();
this.loader = new SystemEnvironmentConfigDataLoader();
}
@Test
void loadLoadsConfigData() throws IOException {
this.environment.put("VAR1", "key1=value1");
ConfigData data = this.loader.load(this.context, createResource("VAR1"));
assertThat(data.getPropertySources()).hasSize(1);
PropertySource<?> propertySource = data.getPropertySources().get(0);
assertThat(propertySource.getProperty("key1")).isEqualTo("value1");
}
@Test
void loadWhenNoContentThrowsException() {
assertThatExceptionOfType(ConfigDataResourceNotFoundException.class)
.isThrownBy(() -> this.loader.load(this.context, createResource("VAR1")))
.withMessage("Config data resource 'system environment variable [VAR1] content "
+ "loaded using PropertiesPropertySourceLoader' cannot be found");
}
private SystemEnvironmentConfigDataResource createResource(String variableName) {
return new SystemEnvironmentConfigDataResource(variableName, new PropertiesPropertySourceLoader(),
this.environment::get, null);
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free