@Test public void testGoodbyeProfile() throws Exception { System.setProperty("spring.profiles.active", "goodbye"); SampleProfileApplication.main(new String[0]); String output = this.outputCapture.toString(); assertThat(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(); assertThat(output).contains("Bonjour Phil"); }
@Test public void testGoodbyeProfileFromCommandline() throws Exception { SampleProfileApplication.main(new String[] {"--spring.profiles.active=goodbye"}); String output = this.outputCapture.toString(); assertThat(output).contains("Goodbye Everyone"); }
@Test public void testDefaultProfile() throws Exception { SampleProfileApplication.main(new String[0]); String output = this.outputCapture.toString(); assertThat(output).contains("Hello Phil"); }