Fix broken test (ordering)

pull/1052/head
Dave Syer 11 years ago
parent 376d6fb9bc
commit dd176ccacf

@ -16,10 +16,12 @@
package org.springframework.boot.autoconfigure.data.mongo; package org.springframework.boot.autoconfigure.data.mongo;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.data.mongodb.core.MongoOperations; import org.springframework.data.mongodb.core.MongoOperations;
@ -55,6 +57,7 @@ import com.mongodb.Mongo;
@ConditionalOnBean(MongoOperations.class) @ConditionalOnBean(MongoOperations.class)
@ConditionalOnMissingBean(MongoRepositoryFactoryBean.class) @ConditionalOnMissingBean(MongoRepositoryFactoryBean.class)
@Import(MongoRepositoriesAutoConfigureRegistrar.class) @Import(MongoRepositoriesAutoConfigureRegistrar.class)
@AutoConfigureAfter(MongoAutoConfiguration.class)
public class MongoRepositoriesAutoConfiguration { public class MongoRepositoriesAutoConfiguration {
} }

@ -22,7 +22,6 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage; import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.data.alt.mongo.CityMongoDbRepository; import org.springframework.boot.autoconfigure.data.alt.mongo.CityMongoDbRepository;
import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage; import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
import org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.data.mongo.city.City; import org.springframework.boot.autoconfigure.data.mongo.city.City;
import org.springframework.boot.autoconfigure.data.mongo.city.CityRepository; import org.springframework.boot.autoconfigure.data.mongo.city.CityRepository;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
@ -58,8 +57,8 @@ public class MongoRepositoriesAutoConfigurationTests {
public void testDefaultRepositoryConfiguration() throws Exception { public void testDefaultRepositoryConfiguration() throws Exception {
this.context = new AnnotationConfigApplicationContext(); this.context = new AnnotationConfigApplicationContext();
this.context.register(TestConfiguration.class, MongoAutoConfiguration.class, this.context.register(TestConfiguration.class, MongoAutoConfiguration.class,
MongoRepositoriesAutoConfiguration.class,
MongoDataAutoConfiguration.class, MongoDataAutoConfiguration.class,
MongoRepositoriesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertNotNull(this.context.getBean(CityRepository.class)); assertNotNull(this.context.getBean(CityRepository.class));
@ -72,8 +71,8 @@ public class MongoRepositoriesAutoConfigurationTests {
public void testNoRepositoryConfiguration() throws Exception { public void testNoRepositoryConfiguration() throws Exception {
this.context = new AnnotationConfigApplicationContext(); this.context = new AnnotationConfigApplicationContext();
this.context.register(EmptyConfiguration.class, MongoAutoConfiguration.class, this.context.register(EmptyConfiguration.class, MongoAutoConfiguration.class,
MongoRepositoriesAutoConfiguration.class,
MongoDataAutoConfiguration.class, MongoDataAutoConfiguration.class,
MongoRepositoriesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
@ -85,8 +84,8 @@ public class MongoRepositoriesAutoConfigurationTests {
public void doesNotTriggerDefaultRepositoryDetectionIfCustomized() { public void doesNotTriggerDefaultRepositoryDetectionIfCustomized() {
this.context = new AnnotationConfigApplicationContext(); this.context = new AnnotationConfigApplicationContext();
this.context.register(CustomizedConfiguration.class, this.context.register(CustomizedConfiguration.class,
MongoAutoConfiguration.class, MongoRepositoriesAutoConfiguration.class, MongoAutoConfiguration.class, MongoDataAutoConfiguration.class,
MongoDataAutoConfiguration.class, MongoRepositoriesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertNotNull(this.context.getBean(CityMongoDbRepository.class)); assertNotNull(this.context.getBean(CityMongoDbRepository.class));

Loading…
Cancel
Save