Newbie Newbie - 3 months ago 52
Java Question

Mock static methods from multiple class using PowerMock

I know how to mock static methods from a class using PowerMock.

But I want to mock static methods from multiple classes in a test class using JUnit and PowerMock.

Can anyone tell me is it possible to do this and how to do it?

Answer

Just do @PrepareForTest({Class1.class,Class2.class}) for multiple classes.