Browse Source

Add missing TestPropertyValues 'apply' calls

Update a few usages of `TestPropertyValues` so that `apply` is called
consistently.
pull/9641/merge
Phillip Webb 9 years ago
parent
commit
fd1dfbb247
  1. 3
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java
  2. 2
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TomcatDataSourceConfigurationTests.java
  3. 6
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfigurationTests.java
  4. 5
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java
  5. 3
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoReactiveAutoConfigurationTests.java
  6. 2
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java
  7. 6
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java

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

@ -84,7 +84,8 @@ public class MongoDataAutoConfigurationTests { @@ -84,7 +84,8 @@ public class MongoDataAutoConfigurationTests {
@Test
public void gridFsTemplateExists() {
this.context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.data.mongodb.gridFsDatabase:grid");
TestPropertyValues.of("spring.data.mongodb.gridFsDatabase:grid")
.applyTo(this.context);
this.context.register(PropertyPlaceholderAutoConfiguration.class,
MongoAutoConfiguration.class, MongoDataAutoConfiguration.class);
this.context.refresh();

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

@ -53,7 +53,7 @@ public class TomcatDataSourceConfigurationTests { @@ -53,7 +53,7 @@ public class TomcatDataSourceConfigurationTests {
@Before
public void init() {
TestPropertyValues.of(PREFIX + "initialize:false");
TestPropertyValues.of(PREFIX + "initialize:false").applyTo(this.context);
}
@After

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

@ -67,7 +67,8 @@ public class SitePreferenceAutoConfigurationTests { @@ -67,7 +67,8 @@ public class SitePreferenceAutoConfigurationTests {
@Test
public void sitePreferenceHandlerInterceptorEnabled() throws Exception {
this.context = new AnnotationConfigWebApplicationContext();
TestPropertyValues.of("spring.mobile.sitepreference.enabled:true");
TestPropertyValues.of("spring.mobile.sitepreference.enabled:true")
.applyTo(this.context);
this.context.register(SitePreferenceAutoConfiguration.class);
this.context.refresh();
assertThat(this.context.getBean(SitePreferenceHandlerInterceptor.class))
@ -97,7 +98,8 @@ public class SitePreferenceAutoConfigurationTests { @@ -97,7 +98,8 @@ public class SitePreferenceAutoConfigurationTests {
@Test
public void sitePreferenceMethodArgumentResolverEnabled() throws Exception {
this.context = new AnnotationConfigWebApplicationContext();
TestPropertyValues.of("spring.mobile.sitepreference.enabled:true");
TestPropertyValues.of("spring.mobile.sitepreference.enabled:true")
.applyTo(this.context);
this.context.register(SitePreferenceAutoConfiguration.class);
this.context.refresh();
assertThat(

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

@ -60,7 +60,7 @@ public class MongoAutoConfigurationTests { @@ -60,7 +60,7 @@ public class MongoAutoConfigurationTests {
@Test
public void optionsAdded() {
this.context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.data.mongodb.host:localhost");
TestPropertyValues.of("spring.data.mongodb.host:localhost").applyTo(this.context);
this.context.register(OptionsConfig.class,
PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class);
this.context.refresh();
@ -71,7 +71,8 @@ public class MongoAutoConfigurationTests { @@ -71,7 +71,8 @@ public class MongoAutoConfigurationTests {
@Test
public void optionsAddedButNoHost() {
this.context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.data.mongodb.uri:mongodb://localhost/test");
TestPropertyValues.of("spring.data.mongodb.uri:mongodb://localhost/test")
.applyTo(this.context);
this.context.register(OptionsConfig.class,
PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class);
this.context.refresh();

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

@ -78,7 +78,8 @@ public class MongoReactiveAutoConfigurationTests { @@ -78,7 +78,8 @@ public class MongoReactiveAutoConfigurationTests {
@Test
public void optionsAddedButNoHost() {
this.context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.data.mongodb.uri:mongodb://localhost/test");
TestPropertyValues.of("spring.data.mongodb.uri:mongodb://localhost/test")
.applyTo(this.context);
this.context.register(OptionsConfig.class,
PropertyPlaceholderAutoConfiguration.class,
MongoReactiveAutoConfiguration.class);

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

@ -84,7 +84,7 @@ public class CustomHibernateJpaAutoConfigurationTests { @@ -84,7 +84,7 @@ public class CustomHibernateJpaAutoConfigurationTests {
@Test
public void testDefaultDdlAutoForEmbedded() throws Exception {
TestPropertyValues.of("spring.datasource.initialize:false");
TestPropertyValues.of("spring.datasource.initialize:false").applyTo(this.context);
this.context.register(TestConfiguration.class,
EmbeddedDataSourceConfiguration.class,
PropertyPlaceholderAutoConfiguration.class,

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

@ -162,7 +162,7 @@ public class SecurityAutoConfigurationTests { @@ -162,7 +162,7 @@ public class SecurityAutoConfigurationTests {
this.context.setServletContext(new MockServletContext());
this.context.register(SecurityAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
TestPropertyValues.of("security.basic.enabled:false");
TestPropertyValues.of("security.basic.enabled:false").applyTo(this.context);
this.context.refresh();
// Ignores and the "matches-none" filter only
assertThat(this.context.getBeanNamesForType(FilterChainProxy.class).length)
@ -277,8 +277,8 @@ public class SecurityAutoConfigurationTests { @@ -277,8 +277,8 @@ public class SecurityAutoConfigurationTests {
public void testJpaCoexistsHappily() throws Exception {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
TestPropertyValues.of("spring.datasource.url:jdbc:hsqldb:mem:testsecdb");
TestPropertyValues.of("spring.datasource.initialize:false");
TestPropertyValues.of("spring.datasource.url:jdbc:hsqldb:mem:testsecdb",
"spring.datasource.initialize:false").applyTo(this.context);
this.context.register(EntityConfiguration.class,
PropertyPlaceholderAutoConfiguration.class,
DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,

Loading…
Cancel
Save