Last Updated: February 25, 2016
·
571
· ieldanr

Stubs vs Mocks: The difference

Many people don't get the difference between Stubs and Mocks. We all know they replace methods and classes when testing, but this is the main difference:

Mocks have expectations. Stubs don't.

This means that for a Mock there are assertions whether or how it gets called. And with a stub there is none.