CachedConfigurationSource implements ConfigurationSource { @Override public Properties getConfiguration(Environment environment) { if (cachedConfigurationPerEnvironment.containsKey(environment.getName())) { return cachedConfigurationPerEnvironment.get(environment.getName()); } else { throw new MissingEnvironmentException(environment.getName()); } } CachedConfigurationSource(ConfigurationSource underlyingSource); @Override Properties getConfiguration(Environment environment); @Override void init(); void reload(Environment environment);  }
@Test void getConfigurationThrowsOnMissingEnvironment() { assertThatThrownBy(() -> cachedConfigurationSource.getConfiguration(new DefaultEnvironment())).isExactlyInstanceOf(MissingEnvironmentException.class); }