@@ -249,37 +249,49 @@ void imageBannerLoads(CapturedOutput output) {
249
249
}
250
250
251
251
@ Test
252
- void logsNoActiveProfiles (CapturedOutput output ) {
252
+ void logsActiveProfilesWithoutProfileAndSingleDefault (CapturedOutput output ) {
253
253
SpringApplication application = new SpringApplication (ExampleConfig .class );
254
254
application .setWebApplicationType (WebApplicationType .NONE );
255
255
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\" " );
257
257
}
258
258
259
259
@ Test
260
- void logsActiveProfiles (CapturedOutput output ) {
260
+ void logsActiveProfilesWithoutProfileAndMultipleDefaults (CapturedOutput output ) {
261
+ MockEnvironment environment = new MockEnvironment ();
262
+ environment .setDefaultProfiles ("p0,p1" , "default" );
261
263
SpringApplication application = new SpringApplication (ExampleConfig .class );
262
264
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\" " );
265
269
}
266
270
267
271
@ 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 );
270
274
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\" " );
274
277
}
275
278
276
279
@ Test
277
- void logsMultipleActiveProfilesWithComma (CapturedOutput output ) {
280
+ void logsActiveProfilesWithMultipleProfiles (CapturedOutput output ) {
278
281
SpringApplication application = new SpringApplication (ExampleConfig .class );
279
282
application .setWebApplicationType (WebApplicationType .NONE );
280
283
application .setAdditionalProfiles ("p1,p2" , "p3" );
281
284
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" );
283
295
}
284
296
285
297
@ Test
0 commit comments