Skip to content

Commit 262111e

Browse files
committed
Fix tests in SpringApplicationTests by removing profiles with commas
1 parent 05e813b commit 262111e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
* @author Moritz Halbritter
166166
* @author Tadaya Tsuyukubo
167167
* @author Yanming Zhou
168+
* @author Sijun Yang
168169
*/
169170
@ExtendWith(OutputCaptureExtension.class)
170171
class SpringApplicationTests {
@@ -252,13 +253,13 @@ void logsActiveProfilesWithoutProfileAndSingleDefault(CapturedOutput output) {
252253
@Test
253254
void logsActiveProfilesWithoutProfileAndMultipleDefaults(CapturedOutput output) {
254255
MockEnvironment environment = new MockEnvironment();
255-
environment.setDefaultProfiles("p0,p1", "default");
256+
environment.setDefaultProfiles("p0", "default");
256257
SpringApplication application = new SpringApplication(ExampleConfig.class);
257258
application.setWebApplicationType(WebApplicationType.NONE);
258259
application.setEnvironment(environment);
259260
this.context = application.run();
260261
assertThat(output)
261-
.contains("No active profile set, falling back to 2 default profiles: \"p0,p1\", \"default\"");
262+
.contains("No active profile set, falling back to 2 default profiles: \"p0\", \"default\"");
262263
}
263264

264265
@Test
@@ -273,9 +274,9 @@ void logsActiveProfilesWithSingleProfile(CapturedOutput output) {
273274
void logsActiveProfilesWithMultipleProfiles(CapturedOutput output) {
274275
SpringApplication application = new SpringApplication(ExampleConfig.class);
275276
application.setWebApplicationType(WebApplicationType.NONE);
276-
application.setAdditionalProfiles("p1,p2", "p3");
277+
application.setAdditionalProfiles("p1", "p2");
277278
application.run();
278-
assertThat(output).contains("The following 2 profiles are active: \"p1,p2\", \"p3\"");
279+
assertThat(output).contains("The following 2 profiles are active: \"p1\", \"p2\"");
279280
}
280281

281282
@Test

0 commit comments

Comments
 (0)