From bb1df5f7508875cf341a7e9498e951b5d0cd8c1a Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Mon, 17 Oct 2022 13:59:21 -0400 Subject: [PATCH] Update tests to use JUnit's Assert Signed-off-by: Andriy Redko --- CHANGELOG.md | 1 + .../integTest/aws/AwsSdk2BulkRequestIT.java | 6 ++--- .../integTest/aws/AwsSdk2SearchIT.java | 22 +++++++++---------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7480e177ce..bf923aeca0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Github workflow for changelog verification ([#239](https://github.com/opensearch-project/opensearch-java/pull/239)) ### Changed +- Update tests to use JUnit's Assert ([#244]https://github.com/opensearch-project/opensearch-java/pull/244) ### Deprecated diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2BulkRequestIT.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2BulkRequestIT.java index 85fcb75a53..36672582ac 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2BulkRequestIT.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2BulkRequestIT.java @@ -9,7 +9,7 @@ package org.opensearch.client.opensearch.integTest.aws; import org.junit.Test; -import org.locationtech.jts.util.Assert; +import org.junit.Assert; import org.opensearch.client.opensearch.OpenSearchClient; import org.opensearch.client.opensearch._types.Refresh; import org.opensearch.client.opensearch._types.query_dsl.Query; @@ -49,7 +49,7 @@ public void testBulkRequest() throws Exception { .operations(ops) .refresh(Refresh.WaitFor); BulkResponse bulkResponse = client.bulk(bulkReq.build()); - Assert.equals(3, bulkResponse.items().size()); + Assert.assertEquals(3, bulkResponse.items().size()); Query query = Query.of(qb -> qb.match(mb -> mb.field("title").query(fv -> fv.stringValue("Document")))); final SearchRequest.Builder searchReq = new SearchRequest.Builder() @@ -60,6 +60,6 @@ public void testBulkRequest() throws Exception { .ignoreThrottled(false) .query(query); SearchResponse searchResponse = client.search(searchReq.build(), SimplePojo.class); - Assert.equals(3, searchResponse.hits().hits().size()); + Assert.assertEquals(3, searchResponse.hits().hits().size()); } } diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2SearchIT.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2SearchIT.java index f81c84ccbd..b138ff8545 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2SearchIT.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2SearchIT.java @@ -9,7 +9,7 @@ package org.opensearch.client.opensearch.integTest.aws; import org.junit.Test; -import org.locationtech.jts.util.Assert; +import org.junit.Assert; import org.opensearch.client.opensearch.OpenSearchAsyncClient; import org.opensearch.client.opensearch.OpenSearchClient; import org.opensearch.client.opensearch._types.OpType; @@ -55,18 +55,18 @@ void testClient(boolean async) throws Exception { addDoc(client, "id3", doc3, true); SearchResponse response = query(client, "NotPresent", null); - Assert.equals(0, response.hits().hits().size()); + Assert.assertEquals(0, response.hits().hits().size()); response = query(client, "Document", null); - Assert.equals(3, response.hits().hits().size()); + Assert.assertEquals(3, response.hits().hits().size()); response = query(client, "1", null); - Assert.equals(1, response.hits().hits().size()); - Assert.equals(doc1, response.hits().hits().get(0).source()); + Assert.assertEquals(1, response.hits().hits().size()); + Assert.assertEquals(doc1, response.hits().hits().get(0).source()); response = query(client, null, "wait"); - Assert.equals(1, response.hits().hits().size()); - Assert.equals(doc3, response.hits().hits().get(0).source()); + Assert.assertEquals(1, response.hits().hits().size()); + Assert.assertEquals(doc3, response.hits().hits().get(0).source()); } void testClientAsync(boolean async) throws Exception { @@ -93,14 +93,14 @@ void testClientAsync(boolean async) throws Exception { }).get(); SearchResponse response = results.get(0); - Assert.equals(0, response.hits().hits().size()); + Assert.assertEquals(0, response.hits().hits().size()); response = results.get(1); - Assert.equals(3, response.hits().hits().size()); + Assert.assertEquals(3, response.hits().hits().size()); response = results.get(2); - Assert.equals(1, response.hits().hits().size()); - Assert.equals(doc1, response.hits().hits().get(0).source()); + Assert.assertEquals(1, response.hits().hits().size()); + Assert.assertEquals(doc1, response.hits().hits().get(0).source()); }