mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Align test for spring.data.mongodb.autoIndexCreation with new default
Closes gh-28481
This commit is contained in:
parent
10f0017d69
commit
2462f67be4
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -147,13 +147,21 @@ class MongoDataAutoConfigurationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void customAutoIndexCreation() {
|
void defaultAutoIndexCreation() {
|
||||||
this.contextRunner.withPropertyValues("spring.data.mongodb.autoIndexCreation:false").run((context) -> {
|
this.contextRunner.run((context) -> {
|
||||||
MongoMappingContext mappingContext = context.getBean(MongoMappingContext.class);
|
MongoMappingContext mappingContext = context.getBean(MongoMappingContext.class);
|
||||||
assertThat(mappingContext.isAutoIndexCreation()).isFalse();
|
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
|
@Test
|
||||||
void interfaceFieldNamingStrategy() {
|
void interfaceFieldNamingStrategy() {
|
||||||
this.contextRunner
|
this.contextRunner
|
||||||
|
Loading…
Reference in New Issue
Block a user