title: Static mocking with PowerMock and Mockito not working
body: <p>I'm trying to verify that the Collections.shuffle() method was called in one of my classes. I read through the (little) documentation on PowerMock with Mockito and read through the other SO questions that dealt with this issue and didn't get a resolution.</p>
  
  <pre><code>@RunWith(PowerMockRunner.class)
  @PrepareForTest(Collections.class)
  public class MyTest {
  
      @Test
      public void testShuffle() {
          PowerMockito.mockStatic(Collections.class);
          PowerMockito.doCallRealMethod().when(Collections.class);
          Collections.shuffle(Mockito.anyListOf(Something.class));
  
          ClassToTest test = new ClassToTest();
          test.doSomething();
  
          PowerMockito.verifyStatic(); // Verify shuffle was called exactly once
          Collections.shuffle(Mockito.anyListOf(Something.class));
      }
  }
  
  public class ClassToTest {
      private final List&lt;Something&gt; list;
      // ...
      public void doSomething() {
          Collections.shuffle(list);
          // do more stuff
      }
  }
  </code></pre>
  
  <p>Given the above code, I expect the unit test pass. However, the unit test fails as follows:</p>
  
  <pre><code>Wanted but not invoked java.util.Collections.shuffle([]);
  Actually, there were zero interactions with this mock.
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT:</strong>
  As per the suggestion below I tried the following, and I get the same error.</p>
  
  <pre><code>@RunWith(PowerMockRunner.class)
  @PrepareForTest(Collections.class)
  public class MyTest {
  
      @Test
      public void testShuffle() {
          PowerMockito.mockStatic(Collections.class);
  
          ClassToTest test = new ClassToTest();
          test.doSomething();
  
          PowerMockito.verifyStatic(); // Verify shuffle was called exactly once
          Collections.shuffle(Mockito.anyListOf(Something.class));
      }
  }
  </code></pre>