Make TestPropertyValues immutable
Update `TestPropertyValues` so that it is totally immutable. Methods now return a new instance rather than changing existing state. See gh-9875
This commit is contained in:
@@ -93,7 +93,7 @@ public class MixedNeo4jRepositoriesAutoConfigurationTests {
|
||||
|
||||
private void load(Class<?> config, String... environment) {
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
||||
TestPropertyValues.of(environment).and("spring.datasource.initialize", "false")
|
||||
TestPropertyValues.of(environment).and("spring.datasource.initialize=false")
|
||||
.applyTo(context);
|
||||
context.register(config);
|
||||
context.register(DataSourceAutoConfiguration.class,
|
||||
|
||||
@@ -130,7 +130,7 @@ public class DataSourceJmxConfigurationTests {
|
||||
private void load(Class<?> config, String... environment) {
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
||||
String jdbcUrl = "jdbc:hsqldb:mem:test-" + UUID.randomUUID().toString();
|
||||
TestPropertyValues.of(environment).and("spring.datasource.url", jdbcUrl)
|
||||
TestPropertyValues.of(environment).and("spring.datasource.url=" + jdbcUrl)
|
||||
.applyTo(context);
|
||||
if (config != null) {
|
||||
context.register(config);
|
||||
|
||||
@@ -104,8 +104,8 @@ public class HikariDataSourceConfigurationTests {
|
||||
|
||||
private void load(String... environment) {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
TestPropertyValues.of(environment).and("spring.datasource.initialize", "false")
|
||||
.and("spring.datasource.type", HikariDataSource.class.getName())
|
||||
TestPropertyValues.of(environment).and("spring.datasource.initialize=false")
|
||||
.and("spring.datasource.type=" + HikariDataSource.class.getName())
|
||||
.applyTo(ctx);
|
||||
ctx.register(DataSourceAutoConfiguration.class);
|
||||
ctx.refresh();
|
||||
|
||||
@@ -213,7 +213,7 @@ public abstract class AbstractJpaAutoConfigurationTests {
|
||||
ctx.setClassLoader(classLoader);
|
||||
}
|
||||
TestPropertyValues.of(environment)
|
||||
.and("spring.datasource.generate-unique-name", "true").applyTo(ctx);
|
||||
.and("spring.datasource.generate-unique-name=true").applyTo(ctx);
|
||||
ctx.register(TestConfiguration.class);
|
||||
if (!ObjectUtils.isEmpty(configs)) {
|
||||
ctx.register(configs);
|
||||
|
||||
Reference in New Issue
Block a user