Java 类org.springframework.boot.autoconfigure.data.mongo.city.CityRepository 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MongoRepositoriesAutoConfigurationTests.java   
@Test
public void testDefaultRepositoryConfiguration() throws Exception {
    prepareApplicationContext(TestConfiguration.class);

    assertThat(this.context.getBean(CityRepository.class)).isNotNull();
    Mongo mongo = this.context.getBean(Mongo.class);
    assertThat(mongo).isInstanceOf(MongoClient.class);
    MongoMappingContext mappingContext = this.context
            .getBean(MongoMappingContext.class);
    @SuppressWarnings("unchecked")
    Set<? extends Class<?>> entities = (Set<? extends Class<?>>) ReflectionTestUtils
            .getField(mappingContext, "initialEntitySet");
    assertThat(entities).hasSize(1);
}
项目:spring-boot-concourse    文件:MongoRepositoriesAutoConfigurationTests.java   
@Test
public void testDefaultRepositoryConfiguration() throws Exception {
    prepareApplicationContext(TestConfiguration.class);

    assertThat(this.context.getBean(CityRepository.class)).isNotNull();
    Mongo mongo = this.context.getBean(Mongo.class);
    assertThat(mongo).isInstanceOf(MongoClient.class);
    MongoMappingContext mappingContext = this.context
            .getBean(MongoMappingContext.class);
    @SuppressWarnings("unchecked")
    Set<? extends Class<?>> entities = (Set<? extends Class<?>>) ReflectionTestUtils
            .getField(mappingContext, "initialEntitySet");
    assertThat(entities).hasSize(1);
}
项目:contestparser    文件:MongoRepositoriesAutoConfigurationTests.java   
@Test
public void testDefaultRepositoryConfiguration() throws Exception {
    prepareApplicationContext(TestConfiguration.class);

    assertNotNull(this.context.getBean(CityRepository.class));
    Mongo mongo = this.context.getBean(Mongo.class);
    assertThat(mongo, is(instanceOf(MongoClient.class)));
    MongoMappingContext mappingContext = this.context
            .getBean(MongoMappingContext.class);
    @SuppressWarnings("unchecked")
    Set<? extends Class<?>> entities = (Set<? extends Class<?>>) ReflectionTestUtils
            .getField(mappingContext, "initialEntitySet");
    assertThat(entities.size(), is(equalTo(1)));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MongoRepositoriesAutoConfigurationTests.java   
@Test(expected = NoSuchBeanDefinitionException.class)
public void autoConfigurationShouldNotKickInEvenIfManualConfigDidNotCreateAnyRepositories() {
    prepareApplicationContext(SortOfInvalidCustomConfiguration.class);

    this.context.getBean(CityRepository.class);
}
项目:spring-boot-concourse    文件:MongoRepositoriesAutoConfigurationTests.java   
@Test(expected = NoSuchBeanDefinitionException.class)
public void autoConfigurationShouldNotKickInEvenIfManualConfigDidNotCreateAnyRepositories() {
    prepareApplicationContext(SortOfInvalidCustomConfiguration.class);

    this.context.getBean(CityRepository.class);
}
项目:contestparser    文件:MongoRepositoriesAutoConfigurationTests.java   
@Test(expected = NoSuchBeanDefinitionException.class)
public void autoConfigurationShouldNotKickInEvenIfManualConfigDidNotCreateAnyRepositories() {
    prepareApplicationContext(SortOfInvalidCustomConfiguration.class);

    this.context.getBean(CityRepository.class);
}