|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2021 the original author or authors. |
| 2 | + * Copyright 2012-2022 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
26 | 26 | import org.springframework.context.annotation.Configuration;
|
27 | 27 | import org.springframework.core.env.StandardEnvironment;
|
28 | 28 | import org.springframework.test.context.ActiveProfiles;
|
29 |
| -import org.springframework.test.context.ContextConfiguration; |
30 | 29 | import org.springframework.test.context.MergedContextConfiguration;
|
31 | 30 | import org.springframework.test.context.TestContext;
|
32 | 31 | import org.springframework.test.context.TestContextManager;
|
@@ -146,65 +145,55 @@ private void assertKey(Map<String, Object> actual, String key, Object value) {
|
146 | 145 | assertThat(actual.get(key)).isEqualTo(value);
|
147 | 146 | }
|
148 | 147 |
|
149 |
| - @SpringBootTest({ "key=myValue", "anotherKey:anotherValue" }) |
150 |
| - @ContextConfiguration(classes = Config.class) |
| 148 | + @SpringBootTest(properties = { "key=myValue", "anotherKey:anotherValue" }, classes = Config.class) |
151 | 149 | static class SimpleConfig {
|
152 | 150 |
|
153 | 151 | }
|
154 | 152 |
|
155 |
| - @SpringBootTest(properties = { "key=myValue", "anotherKey:anotherValue" }) |
156 |
| - @ContextConfiguration(classes = Config.class) |
| 153 | + @SpringBootTest(properties = { "key=myValue", "anotherKey:anotherValue" }, classes = Config.class) |
157 | 154 | static class SimpleConfigNonAlias {
|
158 | 155 |
|
159 | 156 | }
|
160 | 157 |
|
161 |
| - @SpringBootTest("server.port=2345") |
162 |
| - @ContextConfiguration(classes = Config.class) |
| 158 | + @SpringBootTest(properties = "server.port=2345", classes = Config.class) |
163 | 159 | static class OverrideConfig {
|
164 | 160 |
|
165 | 161 | }
|
166 | 162 |
|
167 |
| - @SpringBootTest({ "key=myValue", "otherKey=otherValue" }) |
168 |
| - @ContextConfiguration(classes = Config.class) |
| 163 | + @SpringBootTest(properties = { "key=myValue", "otherKey=otherValue" }, classes = Config.class) |
169 | 164 | static class AppendConfig {
|
170 | 165 |
|
171 | 166 | }
|
172 | 167 |
|
173 |
| - @SpringBootTest({ "key=my=Value", "anotherKey:another:Value" }) |
174 |
| - @ContextConfiguration(classes = Config.class) |
| 168 | + @SpringBootTest(properties = { "key=my=Value", "anotherKey:another:Value" }, classes = Config.class) |
175 | 169 | static class SameSeparatorInValue {
|
176 | 170 |
|
177 | 171 | }
|
178 | 172 |
|
179 |
| - @SpringBootTest({ "key=my:Value", "anotherKey:another=Value" }) |
180 |
| - @ContextConfiguration(classes = Config.class) |
| 173 | + @SpringBootTest(properties = { "key=my:Value", "anotherKey:another=Value" }, classes = Config.class) |
181 | 174 | static class AnotherSeparatorInValue {
|
182 | 175 |
|
183 | 176 | }
|
184 | 177 |
|
185 |
| - @SpringBootTest({ "key=myValue", "variables=foo=FOO\n bar=BAR" }) |
186 |
| - @ContextConfiguration(classes = Config.class) |
| 178 | + @SpringBootTest(properties = { "key=myValue", "variables=foo=FOO\n bar=BAR" }, classes = Config.class) |
187 | 179 | static class NewLineInValue {
|
188 | 180 |
|
189 | 181 | }
|
190 | 182 |
|
191 |
| - @SpringBootTest |
| 183 | + @SpringBootTest(classes = Config.class) |
192 | 184 | @ActiveProfiles({ "profile1", "profile2" })
|
193 |
| - @ContextConfiguration(classes = Config.class) |
194 | 185 | static class MultipleActiveProfiles {
|
195 | 186 |
|
196 | 187 | }
|
197 | 188 |
|
198 |
| - @SpringBootTest |
| 189 | + @SpringBootTest(classes = Config.class) |
199 | 190 | @ActiveProfiles({ "profile1,2" })
|
200 |
| - @ContextConfiguration(classes = Config.class) |
201 | 191 | static class ActiveProfileWithComma {
|
202 | 192 |
|
203 | 193 | }
|
204 | 194 |
|
205 |
| - @SpringBootTest({ "key=myValue" }) |
| 195 | + @SpringBootTest(properties = { "key=myValue" }, classes = Config.class) |
206 | 196 | @ActiveProfiles({ "profile1,2" })
|
207 |
| - @ContextConfiguration(classes = Config.class) |
208 | 197 | static class ActiveProfileWithInlinedProperties {
|
209 | 198 |
|
210 | 199 | }
|
|
0 commit comments