Align test for spring.data.mongodb.autoIndexCreation with new default

Closes gh-28481
This commit is contained in:
Andy Wilkinson 2021-10-29 11:23:35 +01:00
parent 10f0017d69
commit 2462f67be4

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -147,13 +147,21 @@ class MongoDataAutoConfigurationTests {
}
@Test
void customAutoIndexCreation() {
this.contextRunner.withPropertyValues("spring.data.mongodb.autoIndexCreation:false").run((context) -> {
void defaultAutoIndexCreation() {
this.contextRunner.run((context) -> {
MongoMappingContext mappingContext = context.getBean(MongoMappingContext.class);
assertThat(mappingContext.isAutoIndexCreation()).isFalse();
});
}
@Test
void customAutoIndexCreation() {
this.contextRunner.withPropertyValues("spring.data.mongodb.autoIndexCreation:true").run((context) -> {
MongoMappingContext mappingContext = context.getBean(MongoMappingContext.class);
assertThat(mappingContext.isAutoIndexCreation()).isTrue();
});
}
@Test
void interfaceFieldNamingStrategy() {
this.contextRunner