Add missing TestPropertyValues 'apply' calls

Update a few usages of `TestPropertyValues` so that `apply` is called
consistently.
pull/9641/merge
Phillip Webb 7 years ago
parent e1602fe59a
commit fd1dfbb247

@ -84,7 +84,8 @@ public class MongoDataAutoConfigurationTests {
@Test @Test
public void gridFsTemplateExists() { public void gridFsTemplateExists() {
this.context = new AnnotationConfigApplicationContext(); 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, this.context.register(PropertyPlaceholderAutoConfiguration.class,
MongoAutoConfiguration.class, MongoDataAutoConfiguration.class); MongoAutoConfiguration.class, MongoDataAutoConfiguration.class);
this.context.refresh(); this.context.refresh();

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

@ -67,7 +67,8 @@ public class SitePreferenceAutoConfigurationTests {
@Test @Test
public void sitePreferenceHandlerInterceptorEnabled() throws Exception { public void sitePreferenceHandlerInterceptorEnabled() throws Exception {
this.context = new AnnotationConfigWebApplicationContext(); 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.register(SitePreferenceAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertThat(this.context.getBean(SitePreferenceHandlerInterceptor.class)) assertThat(this.context.getBean(SitePreferenceHandlerInterceptor.class))
@ -97,7 +98,8 @@ public class SitePreferenceAutoConfigurationTests {
@Test @Test
public void sitePreferenceMethodArgumentResolverEnabled() throws Exception { public void sitePreferenceMethodArgumentResolverEnabled() throws Exception {
this.context = new AnnotationConfigWebApplicationContext(); 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.register(SitePreferenceAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertThat( assertThat(

@ -60,7 +60,7 @@ public class MongoAutoConfigurationTests {
@Test @Test
public void optionsAdded() { public void optionsAdded() {
this.context = new AnnotationConfigApplicationContext(); 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, this.context.register(OptionsConfig.class,
PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
@ -71,7 +71,8 @@ public class MongoAutoConfigurationTests {
@Test @Test
public void optionsAddedButNoHost() { public void optionsAddedButNoHost() {
this.context = new AnnotationConfigApplicationContext(); 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, this.context.register(OptionsConfig.class,
PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class);
this.context.refresh(); this.context.refresh();

@ -78,7 +78,8 @@ public class MongoReactiveAutoConfigurationTests {
@Test @Test
public void optionsAddedButNoHost() { public void optionsAddedButNoHost() {
this.context = new AnnotationConfigApplicationContext(); 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, this.context.register(OptionsConfig.class,
PropertyPlaceholderAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class,
MongoReactiveAutoConfiguration.class); MongoReactiveAutoConfiguration.class);

@ -84,7 +84,7 @@ public class CustomHibernateJpaAutoConfigurationTests {
@Test @Test
public void testDefaultDdlAutoForEmbedded() throws Exception { 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, this.context.register(TestConfiguration.class,
EmbeddedDataSourceConfiguration.class, EmbeddedDataSourceConfiguration.class,
PropertyPlaceholderAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class,

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

Loading…
Cancel
Save