Mocking is a key technique when it comes to writing unit tests in pretty
much any language. Whether we're testing networking code, code relying on
hardware sensors like the accelerometer, or code using system APIs like
location services - mocking can enable us to write tests a lot easier, and
run them faster in a more predictable way.
This week, let's take a look at a few different situations and how mocking
can be used - or avoided - to make our tests easier to write, read and run.