Commit 3605235c authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '2.2.x'

Closes gh-21041
parents 564aec93 439d9bee
...@@ -70,9 +70,13 @@ class MongoDataAutoConfigurationTests { ...@@ -70,9 +70,13 @@ class MongoDataAutoConfigurationTests {
} }
@Test @Test
void gridFsTemplateExists() { void whenGridFsDatabaseIsConfiguredThenGridFsTemplateIsAutoConfiguredAndUsesIt() {
this.contextRunner.withPropertyValues("spring.data.mongodb.gridFsDatabase:grid") this.contextRunner.withPropertyValues("spring.data.mongodb.gridFsDatabase:grid").run((context) -> {
.run((context) -> assertThat(context).hasSingleBean(GridFsTemplate.class)); assertThat(context).hasSingleBean(GridFsTemplate.class);
GridFsTemplate template = context.getBean(GridFsTemplate.class);
MongoDatabaseFactory factory = (MongoDatabaseFactory) ReflectionTestUtils.getField(template, "dbFactory");
assertThat(factory.getMongoDatabase().getName()).isEqualTo("grid");
});
} }
@Test @Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment