use of cn.taketoday.mock.env.MockPropertySource in project today-framework by TAKETODAY.
the class UnboundElementsSourceFilterTests method filterWhenSourceIsNotSystemShouldReturnTrue.
@Test
void filterWhenSourceIsNotSystemShouldReturnTrue() {
MockPropertySource propertySource = new MockPropertySource("test");
given(this.source.getUnderlyingSource()).willReturn(propertySource);
assertThat(this.filter.apply(this.source)).isTrue();
}
use of cn.taketoday.mock.env.MockPropertySource in project today-framework by TAKETODAY.
the class UnboundElementsSourceFilterTests method filterWhenSourceIsSystemEnvironmentPropertySourceShouldReturnFalse.
@Test
void filterWhenSourceIsSystemEnvironmentPropertySourceShouldReturnFalse() {
MockPropertySource propertySource = new MockPropertySource(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME);
given(this.source.getUnderlyingSource()).willReturn(propertySource);
assertThat(this.filter.apply(this.source)).isFalse();
}
use of cn.taketoday.mock.env.MockPropertySource in project today-framework by TAKETODAY.
the class ConfigurationPropertySourceTests method fromCreatesConfigurationPropertySourcesPropertySource.
@Test
void fromCreatesConfigurationPropertySourcesPropertySource() {
MockPropertySource source = new MockPropertySource();
source.setProperty("spring", "boot");
ConfigurationPropertySource adapted = ConfigurationPropertySource.from(source);
assertThat(adapted.getConfigurationProperty(ConfigurationPropertyName.of("spring")).getValue()).isEqualTo("boot");
}
use of cn.taketoday.mock.env.MockPropertySource in project today-framework by TAKETODAY.
the class InvalidConfigDataPropertyExceptionTests method createInvalidProfileSpecificPropertyContributor.
private ConfigDataEnvironmentContributor createInvalidProfileSpecificPropertyContributor(String name, ConfigData.Option... configDataOptions) {
MockPropertySource propertySource = new MockPropertySource();
propertySource.setProperty(name, "a");
ConfigDataEnvironmentContributor contributor = new ConfigDataEnvironmentContributor(Kind.BOUND_IMPORT, null, null, true, propertySource, ConfigurationPropertySource.from(propertySource), null, ConfigData.Options.of(configDataOptions), null);
return contributor;
}
use of cn.taketoday.mock.env.MockPropertySource in project today-framework by TAKETODAY.
the class InvalidConfigDataPropertyExceptionTests method throwOrWarnWhenHasNoInvalidPropertyDoesNothing.
@Test
void throwOrWarnWhenHasNoInvalidPropertyDoesNothing() {
ConfigDataEnvironmentContributor contributor = ConfigDataEnvironmentContributor.ofExisting(new MockPropertySource());
InvalidConfigDataPropertyException.throwIfPropertyFound(contributor);
}
Aggregations