diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java index 27e70829309..9e3f7763458 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java @@ -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