use of org.springframework.data.mapping.model.FieldNamingStrategy in project spring-boot by spring-projects.
the class MongoDataAutoConfigurationTests method testFieldNamingStrategy.
public void testFieldNamingStrategy(String strategy, Class<? extends FieldNamingStrategy> expectedType) {
this.context = new AnnotationConfigApplicationContext();
if (strategy != null) {
EnvironmentTestUtils.addEnvironment(this.context, "spring.data.mongodb.field-naming-strategy:" + strategy);
}
this.context.register(PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class, MongoDataAutoConfiguration.class);
this.context.refresh();
MongoMappingContext mappingContext = this.context.getBean(MongoMappingContext.class);
FieldNamingStrategy fieldNamingStrategy = (FieldNamingStrategy) ReflectionTestUtils.getField(mappingContext, "fieldNamingStrategy");
assertThat(fieldNamingStrategy.getClass()).isEqualTo(expectedType);
}
Aggregations