I am trying to test my elastic search aggregation. I have a sample json that I want to input and return when i do when(elasticSearch.search(any())).thenReturn(MyOwnReturnResponse).
I am not able to see how to return my sample response from a json file. I specifically want to test my json response to test out my aggregation. I seen many xcontent code but cannot seem to get it to work. Many times it seems like intellij says there is an issue with createParser, as there should be a deprecation handler, so i use Depreciation.throw and it does not recognize that either.
XContentParser parser = XContentType.JSON.xContent().createParser(namedXContentRegistry, inputStream);