Browse Source

Add test for gh-645

pull/653/head
Dave Syer 12 years ago
parent
commit
a615693f39
  1. 11
      spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java
  2. 7
      spring-boot/src/test/resources/testprofiles.yml

11
spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java

@ -318,6 +318,17 @@ public class ConfigFileApplicationListenerTests { @@ -318,6 +318,17 @@ public class ConfigFileApplicationListenerTests {
assertThat(property, equalTo("notempty"));
}
@Test
public void yamlTwoProfiles() throws Exception {
this.initializer.setSearchNames("testprofiles");
this.environment.setActiveProfiles("other", "dev");
this.initializer.onApplicationEvent(this.event);
String property = this.environment.getProperty("my.property");
assertThat(property, equalTo("fromotherprofile"));
property = this.environment.getProperty("my.other");
assertThat(property, equalTo("notempty"));
}
@Test
public void yamlSetsProfiles() throws Exception {
this.initializer.setSearchNames("testsetprofiles");

7
spring-boot/src/test/resources/testprofiles.yml

@ -6,4 +6,9 @@ my: @@ -6,4 +6,9 @@ my:
spring:
profiles: dev
my:
property: fromdevprofile
property: fromdevprofile
---
spring:
profiles: other
my:
property: fromotherprofile
Loading…
Cancel
Save