I\'m setting up mocking a class\' static methods. I have to do this in a @Before-annotated JUnit setup method.
My goal is to setup the class to call re
What are you looking for is called partial mocking.
In PowerMock you can use mockStaticPartial method.
In PowerMockito you can use stubbing, which will stub only the method defined and leave other unchanged:
PowerMockito.stub(PowerMockito.method(StaticUtilClass.class, "someStaticMethod")).toReturn(5);
also don't forget about the
@PrepareForTest(StaticUtilClass.class)