Sources:
Test doubles are used in unit tests to mimic the real objects the tests depend on.
There are several test doubles types:
Dummy is an object that's not actually used in the test. It is used as a placeholder, for example, when there needs a certain type of object to be passed as a parameter to initialize a method.
Stubs provide predetermined responses. They're used to isolate the behavior of the component from its dependencies. They're typically used to simulate the behavior of complex or external components (data bases, web services, external API).
A fake is a simplified real object. They're used for tests that require a real implementation but a lighter and faster one.
Spies record information about how they were interacted with during the test (how many times was the method called, what arguments were passed, the order of method calls).
Mocks are used to verify that certain interactions took place by being pre-programmed to expect certain specification of the calls.
If the mock expects way too specific calls, the test no longer checks for the behavior, but for the inner details of implementation.
When a test knows too much about the inner workings of the class (what methods are called and in what order). The slightest refactoring can break such a test.