Skip to content

Commit 7fd38ef

Browse files
committed
Merge branch '3.4.x' into 3.5.x
Closes gh-46891
2 parents d809779 + 8da9df1 commit 7fd38ef

File tree

2 files changed

+55
-6
lines changed

2 files changed

+55
-6
lines changed

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,6 @@ public ConnectionString getConnectionString() {
260260
.doesNotHaveBean(PropertiesMongoConnectionDetails.class));
261261
}
262262

263-
@Test
264-
void uuidRepresentationDefaultsAreAligned() {
265-
this.contextRunner.run((context) -> assertThat(getSettings(context).getUuidRepresentation())
266-
.isEqualTo(new MongoProperties().getUuidRepresentation()));
267-
}
268-
269263
private MongoClientSettings getSettings(AssertableApplicationContext context) {
270264
assertThat(context).hasSingleBean(MongoClient.class);
271265
MongoClientImpl client = (MongoClientImpl) context.getBean(MongoClient.class);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2012-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.autoconfigure.mongo;
18+
19+
import org.bson.UuidRepresentation;
20+
import org.junit.jupiter.api.Test;
21+
22+
import org.springframework.data.mongodb.config.MongoConfigurationSupport;
23+
24+
import static org.assertj.core.api.Assertions.assertThat;
25+
26+
/**
27+
* Tests for {@link MongoProperties}.
28+
*
29+
* @author Andy Wilkinson
30+
*/
31+
class MongoPropertiesTests {
32+
33+
@Test
34+
void defaultUUidRepresentationIsAlignedWithSpringData() {
35+
UuidRepresentation springDataDefault = springDataDefaultUuidRepresentation();
36+
UuidRepresentation springBootDefault = new MongoProperties().getUuidRepresentation();
37+
assertThat(springBootDefault).isEqualTo(springDataDefault);
38+
}
39+
40+
private UuidRepresentation springDataDefaultUuidRepresentation() {
41+
return new MongoConfigurationSupport() {
42+
43+
@Override
44+
protected String getDatabaseName() {
45+
return "test";
46+
}
47+
48+
UuidRepresentation defaultUuidRepresentation() {
49+
return mongoClientSettings().getUuidRepresentation();
50+
}
51+
52+
}.defaultUuidRepresentation();
53+
}
54+
55+
}

0 commit comments

Comments
 (0)