Fix sample (Exception type changed in Mongo)

This commit is contained in:
Dave Syer 2014-01-30 10:06:35 +00:00
parent a592215651
commit 99a2338323

View File

@ -17,6 +17,7 @@
package sample.data.mongo;
import java.io.IOException;
import java.net.ConnectException;
import org.junit.Rule;
import org.junit.Test;
@ -54,9 +55,9 @@ public class SampleMongoApplicationTests {
@SuppressWarnings("serial")
NestedCheckedException nested = new NestedCheckedException("failed", ex) {
};
if (nested.contains(IOException.class)) {
if (nested.contains(ConnectException.class)) {
Throwable root = nested.getRootCause();
if (root.getMessage().contains("couldn't connect to [localhost")) {
if (root.getMessage().contains("Connection refused")) {
return true;
}
}