From 42c05dcbc1ff9566e2baac06a41dba0556e3c5e7 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Thu, 16 Nov 2023 18:30:45 +0000 Subject: [PATCH] Use correct equalTo value a character not string Signed-off-by: Peter Nied --- .../opensearch/test/framework/cluster/TestRestClient.java | 5 ++--- .../org/opensearch/security/test/helper/rest/RestHelper.java | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/integrationTest/java/org/opensearch/test/framework/cluster/TestRestClient.java b/src/integrationTest/java/org/opensearch/test/framework/cluster/TestRestClient.java index ffdd5d481b..5cae4b27d9 100644 --- a/src/integrationTest/java/org/opensearch/test/framework/cluster/TestRestClient.java +++ b/src/integrationTest/java/org/opensearch/test/framework/cluster/TestRestClient.java @@ -77,7 +77,6 @@ import static java.lang.String.format; import static java.util.Objects.requireNonNull; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.emptyOrNullString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.notNullValue; @@ -298,13 +297,13 @@ public HttpResponse(CloseableHttpResponse inner) throws IllegalStateException, I private void verifyContentType() { final String contentType = this.getHeader(HttpHeaders.CONTENT_TYPE).getValue(); if (contentType.equals("application/json")) { - assertThat("Response body format was not json, body: " + body, body.charAt(0), equalTo("{")); + assertThat("Response body format was not json, body: " + body, body.charAt(0), equalTo('{')); } else { if (body.length() != 0) { assertThat( "Response body format was json, whereas content-type was " + contentType + ", body: " + body, body.charAt(0), - not(equalTo("{")) + not(equalTo('{')) ); } } diff --git a/src/test/java/org/opensearch/security/test/helper/rest/RestHelper.java b/src/test/java/org/opensearch/security/test/helper/rest/RestHelper.java index ecab086908..4bc9193e9e 100644 --- a/src/test/java/org/opensearch/security/test/helper/rest/RestHelper.java +++ b/src/test/java/org/opensearch/security/test/helper/rest/RestHelper.java @@ -91,7 +91,6 @@ import org.opensearch.security.test.helper.file.FileHelper; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.emptyOrNullString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.not; @@ -422,12 +421,12 @@ private void verifyBodyContentType() { .orElseThrow(() -> new RuntimeException("No content type found. Headers:\n" + getHeaders() + "\n\nBody:\n" + body)); if (contentType.equals("application/json")) { - assertThat("Response body format was not json, body: " + body, body.charAt(0), equalTo("{")); + assertThat("Response body format was not json, body: " + body, body.charAt(0), equalTo('{')); } else { assertThat( "Response body format was json, whereas content-type was " + contentType + ", body: " + body, body.charAt(0), - not(equalTo("{")) + not(equalTo('{')) ); } }