@@ -249,37 +249,49 @@ void imageBannerLoads(CapturedOutput output) {
249249 }
250250
251251 @ Test
252- void logsNoActiveProfiles (CapturedOutput output ) {
252+ void logsActiveProfilesWithoutProfileAndSingleDefault (CapturedOutput output ) {
253253 SpringApplication application = new SpringApplication (ExampleConfig .class );
254254 application .setWebApplicationType (WebApplicationType .NONE );
255255 this .context = application .run ();
256- assertThat (output ).contains ("No active profile set, falling back to 1 default profile(s) : \" default\" " );
256+ assertThat (output ).contains ("No active profile set, falling back to 1 default profile: \" default\" " );
257257 }
258258
259259 @ Test
260- void logsActiveProfiles (CapturedOutput output ) {
260+ void logsActiveProfilesWithoutProfileAndMultipleDefaults (CapturedOutput output ) {
261+ MockEnvironment environment = new MockEnvironment ();
262+ environment .setDefaultProfiles ("p0,p1" , "default" );
261263 SpringApplication application = new SpringApplication (ExampleConfig .class );
262264 application .setWebApplicationType (WebApplicationType .NONE );
263- this .context = application .run ("--spring.profiles.active=myprofiles" );
264- assertThat (output ).contains ("The following 1 profile(s) are active: \" myprofiles\" " );
265+ application .setEnvironment (environment );
266+ this .context = application .run ();
267+ assertThat (output )
268+ .contains ("No active profile set, falling back to 2 default profiles: \" p0,p1\" , \" default\" " );
265269 }
266270
267271 @ Test
268- void enableBannerInLogViaProperty (CapturedOutput output ) {
269- SpringApplication application = spy ( new SpringApplication (ExampleConfig .class ) );
272+ void logsActiveProfilesWithSingleProfile (CapturedOutput output ) {
273+ SpringApplication application = new SpringApplication (ExampleConfig .class );
270274 application .setWebApplicationType (WebApplicationType .NONE );
271- this .context = application .run ("--spring.main.banner-mode=log" );
272- then (application ).should (atLeastOnce ()).setBannerMode (Banner .Mode .LOG );
273- assertThat (output ).contains ("o.s.b.SpringApplication" );
275+ this .context = application .run ("--spring.profiles.active=myprofiles" );
276+ assertThat (output ).contains ("The following 1 profile is active: \" myprofiles\" " );
274277 }
275278
276279 @ Test
277- void logsMultipleActiveProfilesWithComma (CapturedOutput output ) {
280+ void logsActiveProfilesWithMultipleProfiles (CapturedOutput output ) {
278281 SpringApplication application = new SpringApplication (ExampleConfig .class );
279282 application .setWebApplicationType (WebApplicationType .NONE );
280283 application .setAdditionalProfiles ("p1,p2" , "p3" );
281284 application .run ();
282- assertThat (output ).contains ("The following 2 profile(s) are active: \" p1,p2\" ,\" p3\" " );
285+ assertThat (output ).contains ("The following 2 profiles are active: \" p1,p2\" , \" p3\" " );
286+ }
287+
288+ @ Test
289+ void enableBannerInLogViaProperty (CapturedOutput output ) {
290+ SpringApplication application = spy (new SpringApplication (ExampleConfig .class ));
291+ application .setWebApplicationType (WebApplicationType .NONE );
292+ this .context = application .run ("--spring.main.banner-mode=log" );
293+ then (application ).should (atLeastOnce ()).setBannerMode (Banner .Mode .LOG );
294+ assertThat (output ).contains ("o.s.b.SpringApplication" );
283295 }
284296
285297 @ Test
0 commit comments