Newbie Newbie - 1 year ago 220
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 Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download