Skip to content

Commit bfbcca3

Browse files
committed
Fix test checks
1 parent 36a16e1 commit bfbcca3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/framework/src/main/java/org/elasticsearch/search/rank/rerank/AbstractRerankerIT.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasId;
3232
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasRank;
3333
import static org.hamcrest.Matchers.arrayWithSize;
34+
import static org.hamcrest.Matchers.emptyArray;
3435
import static org.hamcrest.Matchers.equalTo;
36+
import static org.hamcrest.Matchers.greaterThan;
3537

3638
/**
3739
* this base class acts as a wrapper for testing different rerankers, and their behavior when exceptions are thrown
@@ -191,7 +193,7 @@ public void testRerankerPaginationOutsideOfBounds() throws Exception {
191193
.setFrom(10),
192194
response -> {
193195
assertHitCount(response, 5L);
194-
assertEquals(0, response.getHits().getHits().length);
196+
assertThat(response.getHits().getHits(), emptyArray());
195197
}
196198
);
197199
assertNoOpenContext(indexName);
@@ -227,7 +229,7 @@ public void testNotAllShardsArePresentInFetchPhase() throws Exception {
227229
.setSize(2),
228230
response -> {
229231
assertHitCount(response, 4L);
230-
assertEquals(2, response.getHits().getHits().length);
232+
assertThat(response.getHits().getHits(), arrayWithSize(2));
231233
int rank = 1;
232234
for (SearchHit searchHit : response.getHits().getHits()) {
233235
assertThat(searchHit, hasId(String.valueOf(5 - (rank - 1))));
@@ -398,13 +400,13 @@ public void testRankFeaturePhaseShardThrowingPartialFailures() throws Exception
398400
.setAllowPartialSearchResults(true)
399401
.setSize(10),
400402
response -> {
401-
assertTrue(response.getFailedShards() > 0);
403+
assertThat(response.getFailedShards(), greaterThan(0));
402404
assertTrue(
403405
Arrays.stream(response.getShardFailures())
404406
.allMatch(failure -> failure.getCause().getMessage().contains("rfs - simulated failure"))
405407
);
406408
assertHitCount(response, 5);
407-
assertThat(response.getHits().getHits(), arrayWithSize(5));
409+
assertThat(response.getHits().getHits(), emptyArray());
408410
}
409411
);
410412
assertNoOpenContext(indexName);

0 commit comments

Comments
 (0)