# Unit testing code that uses the HighLevelRestClient

**URL:** <https://discuss.elastic.co/t/unit-testing-code-that-uses-the-highlevelrestclient/132319>\
**Category:** Elasticsearch\
**Created:** [May 17, 2018, 11:14am UTC](https://discuss.elastic.co/t/unit-testing-code-that-uses-the-highlevelrestclient/132319 "2018-05-17T11:14:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnjingle](https://avatars.discourse-cdn.com/v4/letter/j/87869e/32.png) [@johnjingle](https://discuss.elastic.co/u/johnjingle)\
**Post date:** [May 17, 2018, 11:14am UTC](https://discuss.elastic.co/t/unit-testing-code-that-uses-the-highlevelrestclient/132319/1 "2018-05-17T11:14:40Z")

</div>

We use the HighLevelRestClient.index() to index data to Elasticsearch. I am trying to use PowerMockito to mock client.index(IndexRequest). I would welcome any pointers.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 14, 2018, 11:16am UTC](https://discuss.elastic.co/t/unit-testing-code-that-uses-the-highlevelrestclient/132319/2 "2018-06-14T11:16:50Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
