|
|
@ -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");
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
@ -26,7 +26,6 @@ import org.springframework.context.ApplicationContext;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.core.env.StandardEnvironment;
|
|
|
|
import org.springframework.core.env.StandardEnvironment;
|
|
|
|
import org.springframework.test.context.ActiveProfiles;
|
|
|
|
import org.springframework.test.context.ActiveProfiles;
|
|
|
|
import org.springframework.test.context.ContextConfiguration;
|
|
|
|
|
|
|
|
import org.springframework.test.context.MergedContextConfiguration;
|
|
|
|
import org.springframework.test.context.MergedContextConfiguration;
|
|
|
|
import org.springframework.test.context.TestContext;
|
|
|
|
import org.springframework.test.context.TestContext;
|
|
|
|
import org.springframework.test.context.TestContextManager;
|
|
|
|
import org.springframework.test.context.TestContextManager;
|
|
|
@ -146,65 +145,55 @@ class SpringBootContextLoaderTests {
|
|
|
|
assertThat(actual.get(key)).isEqualTo(value);
|
|
|
|
assertThat(actual.get(key)).isEqualTo(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootTest({ "key=myValue", "anotherKey:anotherValue" })
|
|
|
|
@SpringBootTest(properties = { "key=myValue", "anotherKey:anotherValue" }, classes = Config.class)
|
|
|
|
@ContextConfiguration(classes = Config.class)
|
|
|
|
|
|
|
|
static class SimpleConfig {
|
|
|
|
static class SimpleConfig {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootTest(properties = { "key=myValue", "anotherKey:anotherValue" })
|
|
|
|
@SpringBootTest(properties = { "key=myValue", "anotherKey:anotherValue" }, classes = Config.class)
|
|
|
|
@ContextConfiguration(classes = Config.class)
|
|
|
|
|
|
|
|
static class SimpleConfigNonAlias {
|
|
|
|
static class SimpleConfigNonAlias {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootTest("server.port=2345")
|
|
|
|
@SpringBootTest(properties = "server.port=2345", classes = Config.class)
|
|
|
|
@ContextConfiguration(classes = Config.class)
|
|
|
|
|
|
|
|
static class OverrideConfig {
|
|
|
|
static class OverrideConfig {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootTest({ "key=myValue", "otherKey=otherValue" })
|
|
|
|
@SpringBootTest(properties = { "key=myValue", "otherKey=otherValue" }, classes = Config.class)
|
|
|
|
@ContextConfiguration(classes = Config.class)
|
|
|
|
|
|
|
|
static class AppendConfig {
|
|
|
|
static class AppendConfig {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootTest({ "key=my=Value", "anotherKey:another:Value" })
|
|
|
|
@SpringBootTest(properties = { "key=my=Value", "anotherKey:another:Value" }, classes = Config.class)
|
|
|
|
@ContextConfiguration(classes = Config.class)
|
|
|
|
|
|
|
|
static class SameSeparatorInValue {
|
|
|
|
static class SameSeparatorInValue {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootTest({ "key=my:Value", "anotherKey:another=Value" })
|
|
|
|
@SpringBootTest(properties = { "key=my:Value", "anotherKey:another=Value" }, classes = Config.class)
|
|
|
|
@ContextConfiguration(classes = Config.class)
|
|
|
|
|
|
|
|
static class AnotherSeparatorInValue {
|
|
|
|
static class AnotherSeparatorInValue {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootTest({ "key=myValue", "variables=foo=FOO\n bar=BAR" })
|
|
|
|
@SpringBootTest(properties = { "key=myValue", "variables=foo=FOO\n bar=BAR" }, classes = Config.class)
|
|
|
|
@ContextConfiguration(classes = Config.class)
|
|
|
|
|
|
|
|
static class NewLineInValue {
|
|
|
|
static class NewLineInValue {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootTest
|
|
|
|
@SpringBootTest(classes = Config.class)
|
|
|
|
@ActiveProfiles({ "profile1", "profile2" })
|
|
|
|
@ActiveProfiles({ "profile1", "profile2" })
|
|
|
|
@ContextConfiguration(classes = Config.class)
|
|
|
|
|
|
|
|
static class MultipleActiveProfiles {
|
|
|
|
static class MultipleActiveProfiles {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootTest
|
|
|
|
@SpringBootTest(classes = Config.class)
|
|
|
|
@ActiveProfiles({ "profile1,2" })
|
|
|
|
@ActiveProfiles({ "profile1,2" })
|
|
|
|
@ContextConfiguration(classes = Config.class)
|
|
|
|
|
|
|
|
static class ActiveProfileWithComma {
|
|
|
|
static class ActiveProfileWithComma {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootTest({ "key=myValue" })
|
|
|
|
@SpringBootTest(properties = { "key=myValue" }, classes = Config.class)
|
|
|
|
@ActiveProfiles({ "profile1,2" })
|
|
|
|
@ActiveProfiles({ "profile1,2" })
|
|
|
|
@ContextConfiguration(classes = Config.class)
|
|
|
|
|
|
|
|
static class ActiveProfileWithInlinedProperties {
|
|
|
|
static class ActiveProfileWithInlinedProperties {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|