parent
c349cb66ba
commit
577c177d6a
|
|
@ -163,7 +163,7 @@ public class ConfigFileApplicationListenerTests {
|
|||
|
||||
@Test
|
||||
public void yamlProfileCanBeChanged() throws Exception {
|
||||
EnvironmentTestUtils.addEnviroment(this.environment,
|
||||
EnvironmentTestUtils.addEnvironment(this.environment,
|
||||
"spring.profiles.active:prod");
|
||||
this.initializer.setNames("testsetprofiles");
|
||||
this.initializer.onApplicationEvent(this.event);
|
||||
|
|
@ -186,7 +186,7 @@ public class ConfigFileApplicationListenerTests {
|
|||
@Test
|
||||
public void specificResource() throws Exception {
|
||||
String location = "classpath:specificlocation.properties";
|
||||
EnvironmentTestUtils.addEnviroment(this.environment, "spring.config.location:"
|
||||
EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:"
|
||||
+ location);
|
||||
this.initializer.onApplicationEvent(this.event);
|
||||
String property = this.environment.getProperty("my.property");
|
||||
|
|
@ -202,7 +202,7 @@ public class ConfigFileApplicationListenerTests {
|
|||
@Test
|
||||
public void specificResourceAsFile() throws Exception {
|
||||
String location = "file:src/test/resources/specificlocation.properties";
|
||||
EnvironmentTestUtils.addEnviroment(this.environment, "spring.config.location:"
|
||||
EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:"
|
||||
+ location);
|
||||
this.initializer.onApplicationEvent(this.event);
|
||||
assertThat(this.environment.getPropertySources().contains(location), is(true));
|
||||
|
|
@ -239,7 +239,7 @@ public class ConfigFileApplicationListenerTests {
|
|||
@Test
|
||||
public void specificResourceDefaultsToFile() throws Exception {
|
||||
String location = "src/test/resources/specificlocation.properties";
|
||||
EnvironmentTestUtils.addEnviroment(this.environment, "spring.config.location:"
|
||||
EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:"
|
||||
+ location);
|
||||
this.initializer.onApplicationEvent(this.event);
|
||||
assertThat(this.environment.getPropertySources().contains("file:" + location),
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class FileEncodingApplicationListenerTests {
|
|||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void testIllegalState() {
|
||||
EnvironmentTestUtils.addEnviroment(this.environment,
|
||||
EnvironmentTestUtils.addEnvironment(this.environment,
|
||||
"spring.mandatory_file_encoding:FOO");
|
||||
this.initializer.onApplicationEvent(this.event);
|
||||
}
|
||||
|
|
@ -51,7 +51,7 @@ public class FileEncodingApplicationListenerTests {
|
|||
@Test
|
||||
public void testSunnyDayMandated() {
|
||||
Assume.assumeNotNull(System.getProperty("file.encoding"));
|
||||
EnvironmentTestUtils.addEnviroment(this.environment,
|
||||
EnvironmentTestUtils.addEnvironment(this.environment,
|
||||
"spring.mandatory_file_encoding:" + System.getProperty("file.encoding"));
|
||||
this.initializer.onApplicationEvent(this.event);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ public abstract class EnvironmentTestUtils {
|
|||
|
||||
public static void addEnvironment(ConfigurableApplicationContext context,
|
||||
String... pairs) {
|
||||
addEnviroment(context.getEnvironment(), pairs);
|
||||
addEnvironment(context.getEnvironment(), pairs);
|
||||
}
|
||||
|
||||
public static void addEnviroment(ConfigurableEnvironment environment, String... pairs) {
|
||||
public static void addEnvironment(ConfigurableEnvironment environment, String... pairs) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
for (String pair : pairs) {
|
||||
int index = pair.indexOf(":");
|
||||
|
|
|
|||
Loading…
Reference in New Issue