Using Mockito: Matching multiple arguments in a private static method?
<p>I've been trying to use Mockito and PowerMockito to test my code. I have something akin to the following class:</p>

<pre><code>public class asdfClass{

    public static String methodToMock(String item, String otheritem){
      return "asdf";
    }

    public static String methodToMock(String item){
      return "asdf";    
    }
}
</code></pre>

<p>For whatever reason, though, running the following:</p>

<pre><code>PowerMockito.spy(asdfClass.class);

PowerMockito.when(asdfClass.methodToMock(Mockito.any())).thenReturn("asdfghj");
</code></pre>

<p>appears to compile correctly but running</p>

<pre><code>PowerMockito.spy(asdfClass.class);

PowerMockito.when(asdfClass.methodToMock(Mockito.any(), Mockito.any())).thenReturn("asdfghj");
</code></pre>

<p>does not and spits out a "'void' type not allowed here" error on the Mockito.any()s.</p>

<p>Does anyone know what to do about this? The only other result I saw on stackoverflow suggested that the reader take a look at the documentation, though I don't think it said anything about multiple arguments in a private static method.</p>

<p>(In the end I'm hoping to mock a void result with a doNothing though I've boiled the issue I'm having down to the fact that all of my void methods take multiple arguments)</p>

<p>EDIT: Never mind, got it: <a href="https://stackoverflow.com/questions/9719919/is-it-possible-to-use-partial-mocking-for-private-static-methods-in-powermock">Is it possible to use partial mocking for private static methods in PowerMock?</a> (Comment 4 on the chosen answer). Curiously this didn't work before but that might've been a typo on my part for all I know)</p>