Search in sources :

Example 1 with TestAutoConfigurationSorter

use of org.springframework.boot.autoconfigure.TestAutoConfigurationSorter in project spring-boot by spring-projects.

the class CloudAutoConfigurationTests method testOrder.

@Test
public void testOrder() throws Exception {
    TestAutoConfigurationSorter sorter = new TestAutoConfigurationSorter(new CachingMetadataReaderFactory());
    Collection<String> classNames = new ArrayList<>();
    classNames.add(MongoAutoConfiguration.class.getName());
    classNames.add(DataSourceAutoConfiguration.class.getName());
    classNames.add(MongoRepositoriesAutoConfiguration.class.getName());
    classNames.add(JpaRepositoriesAutoConfiguration.class.getName());
    classNames.add(CloudAutoConfiguration.class.getName());
    List<String> ordered = sorter.getInPriorityOrder(classNames);
    assertThat(ordered.get(0)).isEqualTo(CloudAutoConfiguration.class.getName());
}
Also used : TestAutoConfigurationSorter(org.springframework.boot.autoconfigure.TestAutoConfigurationSorter) MongoRepositoriesAutoConfiguration(org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration) ArrayList(java.util.ArrayList) CachingMetadataReaderFactory(org.springframework.core.type.classreading.CachingMetadataReaderFactory) MongoAutoConfiguration(org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration) JpaRepositoriesAutoConfiguration(org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration) DataSourceAutoConfiguration(org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 TestAutoConfigurationSorter (org.springframework.boot.autoconfigure.TestAutoConfigurationSorter)1 JpaRepositoriesAutoConfiguration (org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration)1 MongoRepositoriesAutoConfiguration (org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration)1 DataSourceAutoConfiguration (org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration)1 MongoAutoConfiguration (org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration)1 CachingMetadataReaderFactory (org.springframework.core.type.classreading.CachingMetadataReaderFactory)1