All posts by
Paweł Czubachowski

May 26 2015

Is overmocking bad? And if it is, then why?

The first question is — what is overmocking? There are a couple of answers. When you mock something that you can leave or even should use as it is — this is overmocking. An example of this is a POJO object. Other way to overmock your test is to mock all the dependencies and rely only on verifying interactions with mock objects. You will see that in my examples. Overmocking can also happen when you mock something that you don’t own like an external library.


Paweł Czubachowski

Software developer focused on continuous integration, deployment, clean code and code quality. He has sonar in his eyes and likes to do code reviews for other teams to learn something new or teach someone something new. In private he likes hard rock music, loud choppers and sport.