Skip to content

Commit f07c090

Browse files
committed
Upgrade to Mongo Java Driver 2.12.4
The exception message for a connection timeout has been updated to include the timeout period. The tests for the sample have been updated accordingly. Closes gh-1884
1 parent 7e95dba commit f07c090

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

spring-boot-dependencies/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<log4j.version>1.2.17</log4j.version>
9090
<logback.version>1.1.2</logback.version>
9191
<mockito.version>1.9.5</mockito.version>
92-
<mongodb.version>2.12.3</mongodb.version>
92+
<mongodb.version>2.12.4</mongodb.version>
9393
<mysql.version>5.1.34</mysql.version>
9494
<reactor.version>1.1.5.RELEASE</reactor.version>
9595
<reactor-spring.version>1.1.3.RELEASE</reactor-spring.version>

spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package sample.data.mongo;
1818

19+
import java.util.regex.Pattern;
20+
1921
import org.junit.Rule;
2022
import org.junit.Test;
2123
import org.springframework.boot.test.OutputCapture;
@@ -33,6 +35,9 @@
3335
*/
3436
public class SampleMongoApplicationTests {
3537

38+
private static final Pattern TIMEOUT_MESSAGE_PATTERN = Pattern
39+
.compile("Timed out after [0-9]+ ms while waiting for a server.*");
40+
3641
@Rule
3742
public OutputCapture outputCapture = new OutputCapture();
3843

@@ -61,7 +66,7 @@ private boolean serverNotRunning(IllegalStateException ex) {
6166
if (root.getMessage().contains("Unable to connect to any server")) {
6267
return true;
6368
}
64-
if (root.getMessage().contains("Timed out while waiting for a server")) {
69+
if (TIMEOUT_MESSAGE_PATTERN.matcher(root.getMessage()).matches()) {
6570
return true;
6671
}
6772
}

0 commit comments

Comments
 (0)