Skip to content

Commit

Permalink
Update tests to use JUnit's Assert (opensearch-project#244)
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <[email protected]>

Signed-off-by: Andriy Redko <[email protected]>
  • Loading branch information
reta authored Oct 19, 2022
1 parent db2e5c0 commit 3068b76
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Github workflow for dependabot PRs ([#247](https://github.com/opensearch-project/opensearch-java/pull/247))

### Changed
- Update tests to use JUnit's Assert ([#244]https://github.com/opensearch-project/opensearch-java/pull/244)

### Deprecated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand All @@ -60,6 +60,6 @@ public void testBulkRequest() throws Exception {
.ignoreThrottled(false)
.query(query);
SearchResponse<SimplePojo> searchResponse = client.search(searchReq.build(), SimplePojo.class);
Assert.equals(3, searchResponse.hits().hits().size());
Assert.assertEquals(3, searchResponse.hits().hits().size());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -55,18 +55,18 @@ void testClient(boolean async) throws Exception {
addDoc(client, "id3", doc3, true);

SearchResponse<SimplePojo> 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 {
Expand All @@ -93,14 +93,14 @@ void testClientAsync(boolean async) throws Exception {
}).get();

SearchResponse<SimplePojo> 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());
}


Expand Down

0 comments on commit 3068b76

Please sign in to comment.