Mocking With Mockery


Mockery is a mock object framework that may be used with any unit testing framework. It is a flexible and human-readable domain specific language (DSL) for mocking objects in unit tests. With it, we can create some pretty powerful tests and even test legacy code containing hard dependencies. In this talk, I’ll show how to get started with Mockery. I’ll start with some basic mocking techniques and then move on to cover more advanced topics, including static methods, partial mocks, final classes, and hard dependencies.