Skip to content

Commit cf7664c

Browse files
committed
Cope with version not found in Embedded Mongo's Version enum
Closes gh-15311
1 parent dee8085 commit cf7664c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ private IFeatureAwareVersion determineVersion() {
156156
return version;
157157
}
158158
}
159+
return Versions.withFeatures(
160+
new GenericVersion(this.embeddedProperties.getVersion()));
159161
}
160162
return Versions.withFeatures(
161163
new GenericVersion(this.embeddedProperties.getVersion()),

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import de.flapdoodle.embed.mongo.config.IMongodConfig;
2525
import de.flapdoodle.embed.mongo.config.Storage;
2626
import de.flapdoodle.embed.mongo.distribution.Feature;
27+
import de.flapdoodle.embed.mongo.distribution.Version;
2728
import org.bson.Document;
2829
import org.junit.After;
2930
import org.junit.Test;
@@ -67,7 +68,13 @@ public void defaultVersion() {
6768

6869
@Test
6970
public void customVersion() {
70-
assertVersionConfiguration("3.4.15", "3.4.15");
71+
String version = Version.V3_4_15.asInDownloadPath();
72+
assertVersionConfiguration(version, version);
73+
}
74+
75+
@Test
76+
public void customUnknownVersion() {
77+
assertVersionConfiguration("3.4.1", "3.4.1");
7178
}
7279

7380
@Test

0 commit comments

Comments
 (0)