Commit 63de33ef authored by Dave Syer's avatar Dave Syer

Add further test for activating profiles

The new test asserts that a profile defined in one profile can be
switched off in another. Seems to work.

More gh-483
parent d08d9849
......@@ -110,6 +110,19 @@ public class ConfigFileApplicationListenerTests {
assertThat(property, equalTo("fromotherpropertiesfile"));
}
@Test
public void loadTwoPropertiesFilesWithProfilesAndSwitchOneOff() throws Exception {
EnvironmentTestUtils.addEnvironment(this.environment, "spring.config.location:"
+ "classpath:enabletwoprofiles.properties,"
+ "classpath:enableprofile.properties");
this.initializer.onApplicationEvent(this.event);
assertEquals("myprofile",
StringUtils.arrayToCommaDelimitedString(this.environment
.getActiveProfiles()));
String property = this.environment.getProperty("my.property");
assertThat(property, equalTo("fromtwopropertiesfile"));
}
@Test
public void localFileTakesPrecedenceOverClasspath() throws Exception {
File localFile = new File(new File("."), "application.properties");
......
spring.profiles.active=myprofile,another
my.property=fromtwopropertiesfile
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment