Add extra test for partial overrides

This commit is contained in:
Dave Syer
2013-11-22 08:51:02 +00:00
parent bd26b28aa5
commit d6593fbee6
3 changed files with 54 additions and 2 deletions

View File

@@ -40,8 +40,7 @@ public class SampleProfileApplicationTests {
public void after() {
if (this.profiles != null) {
System.setProperty("spring.profiles.active", this.profiles);
}
else {
} else {
System.clearProperty("spring.profiles.active");
}
}
@@ -61,6 +60,20 @@ public class SampleProfileApplicationTests {
assertTrue("Wrong output: " + output, output.contains("Goodbye Everyone"));
}
@Test
public void testGenericProfile() throws Exception {
/*
* This is a profile that requires a new environment property, and one which is
* only overridden in the current working directory. That file also only contains
* partial overrides, and the default application.yml should still supply the
* "name" property.
*/
System.setProperty("spring.profiles.active", "generic");
SampleProfileApplication.main(new String[0]);
String output = this.outputCapture.toString();
assertTrue("Wrong output: " + output, output.contains("Bonjour Phil"));
}
@Test
public void testGoodbyeProfileFromCommandline() throws Exception {
SampleProfileApplication