Why doesn’t Mockito mock static methods?

I read a few threads here about static methods, and I think I understand the problems misuse/excessive use of static methods can cause. But I didn’t really get to the bottom of why it is hard to mock static methods.

I know other mocking frameworks, like PowerMock, can do that but why can’t Mockito?

I read this article, but the author seems to be religiously against the word static, maybe it’s my poor understanding.

An easy explanation/link would be great.

7 Answers
7

Leave a Comment