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
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package sample.data.mongo;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.test.OutputCapture;
|
||||
@@ -33,6 +35,9 @@ import static org.junit.Assert.assertTrue;
|
||||
*/
|
||||
public class SampleMongoApplicationTests {
|
||||
|
||||
private static final Pattern TIMEOUT_MESSAGE_PATTERN = Pattern
|
||||
.compile("Timed out after [0-9]+ ms while waiting for a server.*");
|
||||
|
||||
@Rule
|
||||
public OutputCapture outputCapture = new OutputCapture();
|
||||
|
||||
@@ -61,7 +66,7 @@ public class SampleMongoApplicationTests {
|
||||
if (root.getMessage().contains("Unable to connect to any server")) {
|
||||
return true;
|
||||
}
|
||||
if (root.getMessage().contains("Timed out while waiting for a server")) {
|
||||
if (TIMEOUT_MESSAGE_PATTERN.matcher(root.getMessage()).matches()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user