Using Mockito's argThat matcher causes "method ambiguous for the type" error
<p>I am trying to mock a method which takes a map and couple other arguments as parameters. My goal is to match the map entries. 
Originally I defined my mock as:</p>

<pre><code>when(discoveryJobCatalogResourceAccessor.findResource(argThat(allOf(hasEntry("start", "testStart"), hasEntry("level", "testLevel"))), any(Integer.class),
            any(Integer.class), any(String.class), any(String.class))).thenReturn(searchResponse);
</code></pre>

<p>This causes the following error:</p>

<pre><code>"The method findResource(Map&lt;String,String&gt;, Integer, Integer, String, String) is ambiguous for the type DiscoveryJobCatalogResourceAccessor"
</code></pre>

<p>When I replace <code>argThat</code> with <code>any(HashMap.class)</code> like this:</p>

<pre><code>when(discoveryJobCatalogResourceAccessor.findResource(any(HashMap.class), any(Integer.class),
            any(Integer.class), any(String.class), any(String.class))).thenReturn(searchResponse);
</code></pre>

<p>the error is gone, but in this case I cannot match the map values. It seems that Mockito's <code>argThat</code> causes the ambiguity. I am wondering if there is a way to use the <code>argThat</code> without causing an error?</p>