use of cn.taketoday.core.env.MapPropertySource in project today-infrastructure by TAKETODAY.
the class DefaultIterableConfigurationPropertySourceTests method containsDescendantOfShouldCheckSourceNames.
@Test
void containsDescendantOfShouldCheckSourceNames() {
Map<String, Object> source = new LinkedHashMap<>();
source.put("foo.bar", "value");
source.put("faf", "value");
EnumerablePropertySource<?> propertySource = new OriginCapablePropertySource<>(new MapPropertySource("test", source));
DefaultIterableConfigurationPropertySource adapter = new DefaultIterableConfigurationPropertySource(propertySource, DefaultPropertyMapper.INSTANCE);
assertThat(adapter.containsDescendantOf(ConfigurationPropertyName.of("foo"))).isEqualTo(ConfigurationPropertyState.PRESENT);
assertThat(adapter.containsDescendantOf(ConfigurationPropertyName.of("faf"))).isEqualTo(ConfigurationPropertyState.ABSENT);
assertThat(adapter.containsDescendantOf(ConfigurationPropertyName.of("fof"))).isEqualTo(ConfigurationPropertyState.ABSENT);
}
use of cn.taketoday.core.env.MapPropertySource in project today-infrastructure by TAKETODAY.
the class ConfigurationPropertyCachingTests method setup.
@BeforeEach
void setup() {
this.environment = new StandardEnvironment();
this.propertySource = new MapPropertySource("test", Collections.singletonMap("spring", "boot"));
this.environment.getPropertySources().addLast(this.propertySource);
}
use of cn.taketoday.core.env.MapPropertySource in project today-infrastructure by TAKETODAY.
the class PropertySourceOriginTests method toStringShouldShowDetails.
@Test
void toStringShouldShowDetails() {
MapPropertySource propertySource = new MapPropertySource("test", new HashMap<>());
PropertySourceOrigin origin = new PropertySourceOrigin(propertySource, "foo");
assertThat(origin.toString()).isEqualTo("\"foo\" from property source \"test\"");
}
use of cn.taketoday.core.env.MapPropertySource in project today-infrastructure by TAKETODAY.
the class PropertySourceOriginTests method getWhenPropertySourceIsNotOriginAwareShouldWrap.
@Test
void getWhenPropertySourceIsNotOriginAwareShouldWrap() {
MapPropertySource propertySource = new MapPropertySource("test", new HashMap<>());
PropertySourceOrigin origin = new PropertySourceOrigin(propertySource, "foo");
assertThat(origin.getPropertySource()).isEqualTo(propertySource);
assertThat(origin.getPropertyName()).isEqualTo("foo");
}
use of cn.taketoday.core.env.MapPropertySource in project today-infrastructure by TAKETODAY.
the class PropertySourceOriginTests method getPropertySourceShouldReturnPropertySource.
@Test
void getPropertySourceShouldReturnPropertySource() {
MapPropertySource propertySource = new MapPropertySource("test", new HashMap<>());
PropertySourceOrigin origin = new PropertySourceOrigin(propertySource, "foo");
assertThat(origin.getPropertySource()).isEqualTo(propertySource);
}
Aggregations