title: How do I mock java.lang.reflect.Method class in PowerMockito?
body: <p>I have a class that implements InvocationHandler as below:</p>
  
  <pre><code>public class MyProxyClass implements InvocationHandler
  {
    public Object invoke (Object proxy, Method method, Object[] args) throws Throwable
    {
      //Do something interesting here
    }
  }
  </code></pre>
  
  <p>Using PowerMock &amp; Mockito, I'm trying to pass in a mocked method object in my unit test class:</p>
  
  <pre><code>@RunWith(PowerMockRunner.class)
  @PrepareForTest({Method.class})
  public class MyProxyTest
  {
    MyProxy underTest;
  
    @Test
    public void testInvoke() throws Throwable
    {
      Method mockMethod = mock(Method.class);
      //...
    }
  }
  </code></pre>
  
  <p>Since Method is <code>final</code>, I've done the <code>@PrepareForTest</code> trick but that doesn't seem to cut it. <strong>Is this because it's bootstrapped? Am I just going about this wrong?</strong></p>
  
  <p>I've been looking at the below links but there's nothing definitive there:</p>
  
  <ul>
  <li><a href="https://code.google.com/p/powermock/wiki/MockitoUsage13" rel="noreferrer">https://code.google.com/p/powermock/wiki/MockitoUsage13</a></li>
  <li><a href="https://code.google.com/p/powermock/wiki/MockSystem" rel="noreferrer">https://code.google.com/p/powermock/wiki/MockSystem</a>
  
  <ul>
  <li>This one seems more geared toward static methods than creating a mock of a final class.</li>
  </ul></li>
  </ul>