title: Performance impact of PowerMockito
body: <p>We had the following pattern and it had dramatic impact on test-execution time.</p>
  
  <p>I want to understand why.</p>
  
  <pre><code>@RunWith(PowerMockRunner.class)
  @PrepareForTest(SomeSingleton.class)
  public class SomeTest {
  
  @Before
  public void setUp() throws Exception {
      PowerMockito.mockStatic(SomeSingleton.class);
      Mockito.when(SomeSingleton.getInstance()).thenReturn(new SomeSingleton());
  }
  </code></pre>
  
  <p>The class SomeSingleton is very legacy and (no joke) gets its shared instance from the spring container.</p>
  
  <p>Remark: I added a public static setter for the instance (spoiling the very idea of the singleton) but won 25 seconds for this!</p>
  
  <p><strong>Question: What exactly does "PrepareForTest" and "mockStatic" do that takes 25secs ?</strong></p>