Skip to content

Commit fd1dfbb

Browse files
committed
Add missing TestPropertyValues 'apply' calls
Update a few usages of `TestPropertyValues` so that `apply` is called consistently.
1 parent e1602fe commit fd1dfbb

7 files changed

+16
-11
lines changed

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ public void templateExists() {
8484
@Test
8585
public void gridFsTemplateExists() {
8686
this.context = new AnnotationConfigApplicationContext();
87-
TestPropertyValues.of("spring.data.mongodb.gridFsDatabase:grid");
87+
TestPropertyValues.of("spring.data.mongodb.gridFsDatabase:grid")
88+
.applyTo(this.context);
8889
this.context.register(PropertyPlaceholderAutoConfiguration.class,
8990
MongoAutoConfiguration.class, MongoDataAutoConfiguration.class);
9091
this.context.refresh();

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class TomcatDataSourceConfigurationTests {
5353

5454
@Before
5555
public void init() {
56-
TestPropertyValues.of(PREFIX + "initialize:false");
56+
TestPropertyValues.of(PREFIX + "initialize:false").applyTo(this.context);
5757
}
5858

5959
@After

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfigurationTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ public void sitePreferenceHandlerInterceptorCreated() {
6767
@Test
6868
public void sitePreferenceHandlerInterceptorEnabled() throws Exception {
6969
this.context = new AnnotationConfigWebApplicationContext();
70-
TestPropertyValues.of("spring.mobile.sitepreference.enabled:true");
70+
TestPropertyValues.of("spring.mobile.sitepreference.enabled:true")
71+
.applyTo(this.context);
7172
this.context.register(SitePreferenceAutoConfiguration.class);
7273
this.context.refresh();
7374
assertThat(this.context.getBean(SitePreferenceHandlerInterceptor.class))
@@ -97,7 +98,8 @@ public void sitePreferenceMethodArgumentResolverCreated() throws Exception {
9798
@Test
9899
public void sitePreferenceMethodArgumentResolverEnabled() throws Exception {
99100
this.context = new AnnotationConfigWebApplicationContext();
100-
TestPropertyValues.of("spring.mobile.sitepreference.enabled:true");
101+
TestPropertyValues.of("spring.mobile.sitepreference.enabled:true")
102+
.applyTo(this.context);
101103
this.context.register(SitePreferenceAutoConfiguration.class);
102104
this.context.refresh();
103105
assertThat(

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void clientExists() {
6060
@Test
6161
public void optionsAdded() {
6262
this.context = new AnnotationConfigApplicationContext();
63-
TestPropertyValues.of("spring.data.mongodb.host:localhost");
63+
TestPropertyValues.of("spring.data.mongodb.host:localhost").applyTo(this.context);
6464
this.context.register(OptionsConfig.class,
6565
PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class);
6666
this.context.refresh();
@@ -71,7 +71,8 @@ public void optionsAdded() {
7171
@Test
7272
public void optionsAddedButNoHost() {
7373
this.context = new AnnotationConfigApplicationContext();
74-
TestPropertyValues.of("spring.data.mongodb.uri:mongodb://localhost/test");
74+
TestPropertyValues.of("spring.data.mongodb.uri:mongodb://localhost/test")
75+
.applyTo(this.context);
7576
this.context.register(OptionsConfig.class,
7677
PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class);
7778
this.context.refresh();

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoReactiveAutoConfigurationTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ public void optionsAdded() {
7878
@Test
7979
public void optionsAddedButNoHost() {
8080
this.context = new AnnotationConfigApplicationContext();
81-
TestPropertyValues.of("spring.data.mongodb.uri:mongodb://localhost/test");
81+
TestPropertyValues.of("spring.data.mongodb.uri:mongodb://localhost/test")
82+
.applyTo(this.context);
8283
this.context.register(OptionsConfig.class,
8384
PropertyPlaceholderAutoConfiguration.class,
8485
MongoReactiveAutoConfiguration.class);

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void testDefaultDdlAutoForMySql() throws Exception {
8484

8585
@Test
8686
public void testDefaultDdlAutoForEmbedded() throws Exception {
87-
TestPropertyValues.of("spring.datasource.initialize:false");
87+
TestPropertyValues.of("spring.datasource.initialize:false").applyTo(this.context);
8888
this.context.register(TestConfiguration.class,
8989
EmbeddedDataSourceConfiguration.class,
9090
PropertyPlaceholderAutoConfiguration.class,

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void testDisableBasicAuthOnApplicationPaths() throws Exception {
162162
this.context.setServletContext(new MockServletContext());
163163
this.context.register(SecurityAutoConfiguration.class,
164164
PropertyPlaceholderAutoConfiguration.class);
165-
TestPropertyValues.of("security.basic.enabled:false");
165+
TestPropertyValues.of("security.basic.enabled:false").applyTo(this.context);
166166
this.context.refresh();
167167
// Ignores and the "matches-none" filter only
168168
assertThat(this.context.getBeanNamesForType(FilterChainProxy.class).length)
@@ -277,8 +277,8 @@ public void testOverrideAuthenticationManagerWithBuilderAndInjectBuilderIntoSecu
277277
public void testJpaCoexistsHappily() throws Exception {
278278
this.context = new AnnotationConfigWebApplicationContext();
279279
this.context.setServletContext(new MockServletContext());
280-
TestPropertyValues.of("spring.datasource.url:jdbc:hsqldb:mem:testsecdb");
281-
TestPropertyValues.of("spring.datasource.initialize:false");
280+
TestPropertyValues.of("spring.datasource.url:jdbc:hsqldb:mem:testsecdb",
281+
"spring.datasource.initialize:false").applyTo(this.context);
282282
this.context.register(EntityConfiguration.class,
283283
PropertyPlaceholderAutoConfiguration.class,
284284
DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,

0 commit comments

Comments
 (0)