I have tried to mock the response for the below method, but it's not working. Not able to mock the search.hits().hits() method.
Any idea how to do that?
SearchResponse<Product> search = client.search(s -> s
.index("products")
.query(q -> q
.term(t -> t
.field("name")
.value(v -> v.stringValue("bicycle"))
)),
Product.class);
for (Hit<Product> hit: search.hits().hits()) {
processProduct(hit.source());
}
Reference for code- https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/connecting.html#_your_first_request