use of cn.taketoday.framework.context.config.ConfigData.PropertySourceOptions in project today-infrastructure by TAKETODAY.
the class ConfigDataTests method propertySourceOptionsAlwaysReturnsSameOptionsEachTime.
@Test
void propertySourceOptionsAlwaysReturnsSameOptionsEachTime() {
PropertySourceOptions options = PropertySourceOptions.always(Option.IGNORE_IMPORTS, Option.IGNORE_PROFILES);
assertThat(options.get(mock(PropertySource.class)).asSet()).containsExactly(Option.IGNORE_IMPORTS, Option.IGNORE_PROFILES);
}
use of cn.taketoday.framework.context.config.ConfigData.PropertySourceOptions in project today-infrastructure by TAKETODAY.
the class ConfigDataTests method getOptionsReturnsOptionsFromPropertySourceOptions.
@Test
void getOptionsReturnsOptionsFromPropertySourceOptions() {
MapPropertySource source1 = new MapPropertySource("test", Collections.emptyMap());
MapPropertySource source2 = new MapPropertySource("test", Collections.emptyMap());
Options options1 = Options.of(Option.IGNORE_IMPORTS);
Options options2 = Options.of(Option.IGNORE_PROFILES);
PropertySourceOptions propertySourceOptions = (source) -> (source != source1) ? options2 : options1;
ConfigData configData = new ConfigData(Arrays.asList(source1, source2), propertySourceOptions);
assertThat(configData.getOptions(source1)).isEqualTo(options1);
assertThat(configData.getOptions(source2)).isEqualTo(options2);
}
use of cn.taketoday.framework.context.config.ConfigData.PropertySourceOptions in project today-infrastructure by TAKETODAY.
the class ConfigDataTests method getOptionsWhenPropertySourceOptionsReturnsNullReturnsNone.
@Test
void getOptionsWhenPropertySourceOptionsReturnsNullReturnsNone() {
MapPropertySource source = new MapPropertySource("test", Collections.emptyMap());
PropertySourceOptions propertySourceOptions = (propertySource) -> null;
ConfigData configData = new ConfigData(Collections.singleton(source), propertySourceOptions);
assertThat(configData.getOptions(source)).isEqualTo(Options.NONE);
}
use of cn.taketoday.framework.context.config.ConfigData.PropertySourceOptions in project today-framework by TAKETODAY.
the class ConfigDataTests method getOptionsWhenPropertySourceOptionsReturnsNullReturnsNone.
@Test
void getOptionsWhenPropertySourceOptionsReturnsNullReturnsNone() {
MapPropertySource source = new MapPropertySource("test", Collections.emptyMap());
PropertySourceOptions propertySourceOptions = (propertySource) -> null;
ConfigData configData = new ConfigData(Collections.singleton(source), propertySourceOptions);
assertThat(configData.getOptions(source)).isEqualTo(Options.NONE);
}
use of cn.taketoday.framework.context.config.ConfigData.PropertySourceOptions in project today-framework by TAKETODAY.
the class ConfigDataTests method getOptionsReturnsOptionsFromPropertySourceOptions.
@Test
void getOptionsReturnsOptionsFromPropertySourceOptions() {
MapPropertySource source1 = new MapPropertySource("test", Collections.emptyMap());
MapPropertySource source2 = new MapPropertySource("test", Collections.emptyMap());
Options options1 = Options.of(Option.IGNORE_IMPORTS);
Options options2 = Options.of(Option.IGNORE_PROFILES);
PropertySourceOptions propertySourceOptions = (source) -> (source != source1) ? options2 : options1;
ConfigData configData = new ConfigData(Arrays.asList(source1, source2), propertySourceOptions);
assertThat(configData.getOptions(source1)).isEqualTo(options1);
assertThat(configData.getOptions(source2)).isEqualTo(options2);
}
Aggregations