EnvironmentVariablesConfigurationSource implements ConfigurationSource { @Override public Properties getConfiguration(Environment environment) { if (!initialized) { throw new IllegalStateException("Configuration source has to be successfully initialized before you request configuration."); } environmentVariables.clear(); environmentVariables.putAll(System.getenv()); Properties properties = new Properties(); String environmentContext = formatEnvironmentContext(environment); for (Map.Entry<String, String> entry : environmentVariables.entrySet()) { if (entry.getKey().startsWith(environmentContext)) { properties.put(convertToPropertiesKey(entry.getKey(), environmentContext), entry.getValue()); } } return properties; }  @Override Properties getConfiguration(Environment environment); @Override void init(); @Override String toString();  }
@Test void returnsPath() { assertThat(source.getConfiguration(new DefaultEnvironment())).containsKey("PATH"); }
@Test void returnsPathForAnyEnvironment() { assertThat(source.getConfiguration(mock(Environment.class))).containsKey("PATH"); }