Skip to content

Commit 2462f67

Browse files
committed
Align test for spring.data.mongodb.autoIndexCreation with new default
Closes gh-28481
1 parent 10f0017 commit 2462f67

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -147,13 +147,21 @@ void customFieldNamingStrategy() {
147147
}
148148

149149
@Test
150-
void customAutoIndexCreation() {
151-
this.contextRunner.withPropertyValues("spring.data.mongodb.autoIndexCreation:false").run((context) -> {
150+
void defaultAutoIndexCreation() {
151+
this.contextRunner.run((context) -> {
152152
MongoMappingContext mappingContext = context.getBean(MongoMappingContext.class);
153153
assertThat(mappingContext.isAutoIndexCreation()).isFalse();
154154
});
155155
}
156156

157+
@Test
158+
void customAutoIndexCreation() {
159+
this.contextRunner.withPropertyValues("spring.data.mongodb.autoIndexCreation:true").run((context) -> {
160+
MongoMappingContext mappingContext = context.getBean(MongoMappingContext.class);
161+
assertThat(mappingContext.isAutoIndexCreation()).isTrue();
162+
});
163+
}
164+
157165
@Test
158166
void interfaceFieldNamingStrategy() {
159167
this.contextRunner

0 commit comments

Comments
 (0)