Mock static methods from multiple class using PowerMock

Newbie picture Newbie · Apr 26, 2012 · Viewed 70.4k times · Source

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

artbristol picture artbristol · Apr 26, 2012

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