use of org.springframework.data.mapping.context.MappingContextEvent in project spring-data-mongodb by spring-projects.
the class MongoPersistentEntityIndexCreatorUnitTests method doesNotCreateIndexForEntityComingFromDifferentMappingContext.
@Test
void doesNotCreateIndexForEntityComingFromDifferentMappingContext() {
MongoMappingContext mappingContext = new MongoMappingContext();
MongoMappingContext personMappingContext = prepareMappingContext(Person.class);
MongoPersistentEntityIndexCreator creator = new MongoPersistentEntityIndexCreator(mappingContext, mongoTemplate);
MongoPersistentEntity<?> entity = personMappingContext.getRequiredPersistentEntity(Person.class);
MappingContextEvent<MongoPersistentEntity<?>, MongoPersistentProperty> event = new MappingContextEvent<MongoPersistentEntity<?>, MongoPersistentProperty>(personMappingContext, entity);
creator.onApplicationEvent(event);
verifyNoInteractions(collection);
}
Aggregations