ElasticsearchResponse implements Iterable<ExprValue> { public boolean isEmpty() { return (hits.getHits() == null) || (hits.getHits().length == 0) && aggregations == null; } ElasticsearchResponse(SearchResponse esResponse,
                               ElasticsearchExprValueFactory exprValueFactory);  ElasticsearchResponse(SearchHits hits, ElasticsearchExprValueFactory exprValueFactory); boolean isEmpty(); boolean isAggregationResponse(); Iterator<ExprValue> iterator();  }
@Test void isEmpty() { when(esResponse.getHits()) .thenReturn( new SearchHits( new SearchHit[] {searchHit1, searchHit2}, new TotalHits(2L, TotalHits.Relation.EQUAL_TO), 1.0F)); ElasticsearchResponse response1 = new ElasticsearchResponse(esResponse, factory); assertFalse(response1.isEmpty()); when(esResponse.getHits()).thenReturn(SearchHits.empty()); ElasticsearchResponse response2 = new ElasticsearchResponse(esResponse, factory); assertTrue(response2.isEmpty()); when(esResponse.getHits()) .thenReturn(new SearchHits(null, new TotalHits(0, TotalHits.Relation.EQUAL_TO), 0)); ElasticsearchResponse response3 = new ElasticsearchResponse(esResponse, factory); assertTrue(response3.isEmpty()); }