LLClient: Fix assertion on windows

In windows the exception message is ever so slightly differant than in
Linux and OSX. That is fine. We'll just catch either.
This commit is contained in:
Nik Everett 2018-06-15 08:02:47 -04:00
parent a0d6c19e75
commit 045f76d67f
1 changed files with 4 additions and 1 deletions

View File

@ -42,7 +42,9 @@ import java.util.concurrent.TimeUnit;
import static org.elasticsearch.client.RestClientTestUtil.getAllStatusCodes; import static org.elasticsearch.client.RestClientTestUtil.getAllStatusCodes;
import static org.elasticsearch.client.RestClientTestUtil.randomErrorNoRetryStatusCode; import static org.elasticsearch.client.RestClientTestUtil.randomErrorNoRetryStatusCode;
import static org.elasticsearch.client.RestClientTestUtil.randomOkStatusCode; import static org.elasticsearch.client.RestClientTestUtil.randomOkStatusCode;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
@ -214,7 +216,8 @@ public class RestClientMultipleHostsIntegTests extends RestClientTestCase {
restClient.performRequest(request); restClient.performRequest(request);
fail("expected to fail to connect"); fail("expected to fail to connect");
} catch (ConnectException e) { } catch (ConnectException e) {
assertEquals("Connection refused", e.getMessage()); // This is different in windows and linux but this matches both.
assertThat(e.getMessage(), startsWith("Connection refused"));
} }
} else { } else {
Response response = restClient.performRequest(request); Response response = restClient.performRequest(request);