Today I was on a JUG lecture about PowerMock. At first glance it looks as the savior for testing legacy code. But that’s just what it is, it only looks like it will work in a real world case. The only case where it will do good work, is when you want to add test coverage on some legacy code, so that you can do a complicted refactoring to improve the design.
I say complicated refactoring because simple refactorings are built in to our IDE’s, and they have their own tests that proves that they work.
If you are thinking that adding PowerMock to your project will automatically break the downward spiral of the code base, without setting strict guidelines on its use cases you will increase the rate of code base decline.
To conclude PowerMock is valid as a tool to be used as a refactoring aid to help with opening up a class for proper testing, nothing more.