Mockito - I understand a spy calls the real methods on an object, while a mock calls methods on the double object. Also spies are to be avoided unless there is a code smell. However, how do spies work and when should i actually use them? How are they different from mocks?
Technically speaking both "mocks" and "spies" are a special kind of "test doubles".
Mockito is unfortunately making the distinction weird.
A mock in mockito is a normal mock in other mocking frameworks (allows you to stub invocations; that is, return specific values out of method calls).
A spy in mockito is a partial mock in other mocking frameworks (part of the object will be mocked and part will use real method invocations).