Why not PowerMock

I am working on a project in which we are currently testing with JUnit and Mockito. Now I'm trying to figure out what the side effects of adding PowerMock to the mix will be.

What are its shortcomings, any dependencies that I should know about, any stability problems?

I saw that it supports Java 8. Are there any problems there? From what I read, getting support for Java 7 was pretty long.

EDIT: I think the questions that would summarize all this:

What would be the reason not to use PowerMock?

+7
java junit mockito powermock
source share
1 answer

As a rule, if you are starting a new project and want (want / forced) to use PowerMock because of the architecture of your code, this means that this architecture is bad and needs to be improved. Power Mock gives you access to the layout of static methods, constructors, etc., which means that your code does not comply with the best programming principles.

Power Mock should be used in legacy applications where you cannot change the code provided to you. Often such code does not have unit / integration tests, and even a small change can lead to application errors.

+28
source share

All Articles