@Test @SuppressWarnings("unchecked") public void entityScanShouldSetInitialEntitySet() throws Exception { this.context = new AnnotationConfigApplicationContext(); this.context.register(EntityScanConfig.class, PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class, MongoDataAutoConfiguration.class); this.context.refresh(); MongoMappingContext mappingContext = this.context .getBean(MongoMappingContext.class); Set<Class<?>> initialEntitySet = (Set<Class<?>>) ReflectionTestUtils .getField(mappingContext, "initialEntitySet"); assertThat(initialEntitySet).containsOnly(City.class, Country.class); }