Add extra test for partial overrides
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user