I am trying to write a Junit test in Spring Java for org.opensearch.client.opensearch.OpenSearchClient APIs like msearch, bulk, etc. but I get compilation error.
The API signature being mocked is
public <TDocument> MsearchResponse<TDocument> msearch(MsearchRequest request, Class<TDocument> tDocumentClass)
throws IOException, OpenSearchException
The example of unit test mock approach is;
Mockito.when(client.msearch(ArgumentMatchers.any(), ArgumentMatchers.any()))
.thenReturn(mSearchResponse);
Error message seen was as below'
The method msearch(MsearchRequest, Class) is ambiguous for the type OpenSearchClient
Can anyone guide, share how can correctly mock and test OpenSearchClient APIs?