title: Mocking static methods with Robolectric and PowerMockito
body: <p>I'm implementing tests with Roboelectric and I'm trying to implement a test that must check that a static method has or has not been called. My test looks like that:</p>
  
  <pre><code>@RunWith(RobolectricTestRunner.class)
  @Config(manifest=Config.NONE)
  @PrepareForTest({DeviceUtils.class})
  @SmallTest
  public class ContactsListPresenterTest extends BasePresenterTest {    
      ...
  
      @Test
      public void onCallContactClicked_nullArgument_methodNotCalled() {
          PowerMockito.mockStatic(DeviceUtils.class);
          presenter.onCallNotaryClicked(context, null);
          PowerMockito.verifyStatic(Mockito.never());
          DeviceUtils.dialPhoneNumber(context, Mockito.anyString());
      }
      @Test
      public void onCallContactClicked_nullArgument_methodCalled() {
          PowerMockito.mockStatic(DeviceUtils.class);
          presenter.onCallNotaryClicked(context, new Contact());
          PowerMockito.verifyStatic(Mockito.times(1));
          DeviceUtils.dialPhoneNumber(context, Mockito.anyString());
      }
  }
  </code></pre>
  
  <p>However the test is failing with the following error:</p>
  
  <pre><code>org.powermock.api.mockito.ClassNotPreparedException: 
  The class x.DeviceUtils not prepared for test.
  To prepare this class, add class to the '@PrepareForTest' annotation.
  In case if you don't use this annotation, add the annotation on class or  method level. 
  </code></pre>
  
  <p>What am I doing wrong? I have already add the @PrepareForTest annotation, I guess that this is all because I'm using RobolectricTestRunner instead of PowerMockitoRunner, but I need RoboelectricTestRunner for others tests in this same class.</p>
  
  <p>Thanks a lot</p>