Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests to use JUnit's Assert #244

Merged
merged 1 commit into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

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