title: Spring boot mocking static methods with PowerMock in Integration test
body: <p>I'm writing integration test on a RestController in SpringBoot.
  Normally I would run with SpringRunner.class, but when it comes to Mock a static method I need to use PowerMock.</p>
  
  <p>The strange fact is that when I run the single tests, they individually pass (but returns error messages), when I try to run the entire test class, no test passes and it returns the same error message.</p>
  
  <pre><code>@RunWith(PowerMockRunner.class)
  @PrepareForTest({JwtUtils.class})
  //@PowerMockRunnerDelegate(SpringRunner.class) THIS DOESN'T WORK!!!
  @SpringBootTest(classes = SpringBootJwtApplication.class)
  public class RestAccessIntegrationTest {
  
    @Autowired @InjectMocks
    RestController restController;
  
    @Mock
    HttpServletRequest request;
  
    @Test
    public void operationsPerAccountWhenSuccessfulTest(){
      mockStatic(JwtUtils.class);
      when(JwtUtils.myMethod(request)).thenReturn("blabla");
      String expected = ... ;
      String actual = restController.getOperations();
      assertEquals(actual, expected);
    }
  
  }
  </code></pre>
  
  <p>If I run the test or the entire class I get an error of this type:</p>
  
  <p>Exception in thread "main" java.lang.NoSuchMethodError: org.powermock.core.MockRepository.addAfterMethodRunner(Ljava/lang/Runnable;)at org.powermock.api.mockito.internal.mockcreation.MockCreator.mock(MockCreator.java:50)</p>
  
  <p>If I uncomment @PowerMockRunnerDelegate(SpringRunner.class) there it comes this other error:</p>
  
  <p>Exception in thread "main" java.lang.NoClassDefFoundError: org/powermock/core/testlisteners/GlobalNotificationBuildSupport$Callback
  at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.run(DelegatingPowerMockRunner.java:139)</p>