From 045f76d67f37f315fc42a3960ce88500e105f0d6 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Fri, 15 Jun 2018 08:02:47 -0400 Subject: [PATCH] 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. --- .../client/RestClientMultipleHostsIntegTests.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/rest/src/test/java/org/elasticsearch/client/RestClientMultipleHostsIntegTests.java b/client/rest/src/test/java/org/elasticsearch/client/RestClientMultipleHostsIntegTests.java index 92a960090ad..d09741ea25b 100644 --- a/client/rest/src/test/java/org/elasticsearch/client/RestClientMultipleHostsIntegTests.java +++ b/client/rest/src/test/java/org/elasticsearch/client/RestClientMultipleHostsIntegTests.java @@ -42,7 +42,9 @@ import java.util.concurrent.TimeUnit; import static org.elasticsearch.client.RestClientTestUtil.getAllStatusCodes; import static org.elasticsearch.client.RestClientTestUtil.randomErrorNoRetryStatusCode; import static org.elasticsearch.client.RestClientTestUtil.randomOkStatusCode; +import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -214,7 +216,8 @@ public class RestClientMultipleHostsIntegTests extends RestClientTestCase { restClient.performRequest(request); fail("expected to fail to connect"); } 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 { Response response = restClient.performRequest(request);