From 74c522c74527ab79cc9093766ddc8a27d36a3607 Mon Sep 17 00:00:00 2001 From: izeye Date: Sun, 19 Dec 2021 17:55:49 +0900 Subject: [PATCH 1/2] Polish SpringBootContextLoaderTests See gh-29112 --- .../context/SpringBootContextLoaderTests.java | 31 ++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java index 737104a127..22c6fbaa40 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java @@ -26,7 +26,6 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.StandardEnvironment; import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.MergedContextConfiguration; import org.springframework.test.context.TestContext; import org.springframework.test.context.TestContextManager; @@ -146,65 +145,55 @@ class SpringBootContextLoaderTests { assertThat(actual.get(key)).isEqualTo(value); } - @SpringBootTest({ "key=myValue", "anotherKey:anotherValue" }) - @ContextConfiguration(classes = Config.class) + @SpringBootTest(properties = { "key=myValue", "anotherKey:anotherValue" }, classes = Config.class) static class SimpleConfig { } - @SpringBootTest(properties = { "key=myValue", "anotherKey:anotherValue" }) - @ContextConfiguration(classes = Config.class) + @SpringBootTest(properties = { "key=myValue", "anotherKey:anotherValue" }, classes = Config.class) static class SimpleConfigNonAlias { } - @SpringBootTest("server.port=2345") - @ContextConfiguration(classes = Config.class) + @SpringBootTest(properties = "server.port=2345", classes = Config.class) static class OverrideConfig { } - @SpringBootTest({ "key=myValue", "otherKey=otherValue" }) - @ContextConfiguration(classes = Config.class) + @SpringBootTest(properties = { "key=myValue", "otherKey=otherValue" }, classes = Config.class) static class AppendConfig { } - @SpringBootTest({ "key=my=Value", "anotherKey:another:Value" }) - @ContextConfiguration(classes = Config.class) + @SpringBootTest(properties = { "key=my=Value", "anotherKey:another:Value" }, classes = Config.class) static class SameSeparatorInValue { } - @SpringBootTest({ "key=my:Value", "anotherKey:another=Value" }) - @ContextConfiguration(classes = Config.class) + @SpringBootTest(properties = { "key=my:Value", "anotherKey:another=Value" }, classes = Config.class) static class AnotherSeparatorInValue { } - @SpringBootTest({ "key=myValue", "variables=foo=FOO\n bar=BAR" }) - @ContextConfiguration(classes = Config.class) + @SpringBootTest(properties = { "key=myValue", "variables=foo=FOO\n bar=BAR" }, classes = Config.class) static class NewLineInValue { } - @SpringBootTest + @SpringBootTest(classes = Config.class) @ActiveProfiles({ "profile1", "profile2" }) - @ContextConfiguration(classes = Config.class) static class MultipleActiveProfiles { } - @SpringBootTest + @SpringBootTest(classes = Config.class) @ActiveProfiles({ "profile1,2" }) - @ContextConfiguration(classes = Config.class) static class ActiveProfileWithComma { } - @SpringBootTest({ "key=myValue" }) + @SpringBootTest(properties = { "key=myValue" }, classes = Config.class) @ActiveProfiles({ "profile1,2" }) - @ContextConfiguration(classes = Config.class) static class ActiveProfileWithInlinedProperties { } From 5f03ace40f6e02689b82bea885ea43588dd7fa29 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 13 Jan 2022 08:43:03 +0100 Subject: [PATCH 2/2] Update copyright year of changed file See gh-29112 --- .../boot/test/context/SpringBootContextLoaderTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java index 22c6fbaa40..2cf23eec3c 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.