title: Powermockito doNothing for method with arguments
body: <p>I've developed an application in Java and I'm trying to create unit tests using Powermockito (I should add that I'm new to unit testing).</p>
  
  <p>I have a class called Resource which has a static method called readResources:</p>
  
  <pre><code>public static void readResources(ResourcesElement resourcesElement);
  </code></pre>
  
  <p>ResourcesElement is also coded by me.
  In testing, I want to create my own Resource, so I want the above method to do nothing.
  I tried using this code:</p>
  
  <pre><code>    PowerMockito.spy(Resource.class);
      PowerMockito.doNothing().when(Resource.class, "readResources", Matchers.any(ResourcesElement.class));
  </code></pre>
  
  <p>The unit test throws an exception:</p>
  
  <blockquote>
    <p>org.mockito.exceptions.misusing.UnfinishedStubbingException: 
    Unfinished stubbing detected here:
    -> at org.powermock.api.mockito.internal.PowerMockitoCore.doAnswer(PowerMockitoCore.java:36)</p>
  </blockquote>
  
  <p>Powermockito also suggest that I should use thenReturn or thenThrow after when, but it seems that the method 'when' returns void when it is called after doNothing (which is logical).
  If I try:</p>
  
  <pre><code>PowerMockito.when(Resource.class, "readResources", Matchers.any(ResourcesElement.class)).....
  </code></pre>
  
  <p>doNothing is not an option after when.</p>
  
  <p>I managed to make methods without arguments to do nothing, using the 2 arguments version of the method. For example:</p>
  
  <pre><code>PowerMockito.doNothing().when(Moduler.class, "startProcessing");
  </code></pre>
  
  <p>This works (startProcessing doesn't take any arguments).</p>
  
  <p>But how can I make methods that do take arguments to do nothing with Powermockito?</p>