I would like to make use of Powermock with Mockito to mock some static method calls. I have followed instructions and examples from SO as well as the PowerMock Getting Started
If you are using a static mock object, in your PrepareForTest
annotation, add the class that is USING the static object in addition to the static class itself. If the class you are testing needs to use this static, add the current class to the annotation. You don't actually mock the class, but it needs to be in the annotation for the static to hook in. It sounds weird, but it works.
When adding multiple classes into the annotation you can have them inside {}
and seperated by commas. For example if your static class is StaticA.class
and the class using the static is CallerOfStatic.class
you can use:
@RunWith(PowerMockRunner.class)
@PrepareForTest({StaticA.class, CallerOfStatic.class})