By using a test double each test can control how a dependency behaves. In Working Effectively with Legacy Code, Michael Feathers likens a test to a vise. It’s a tool to fix a particular behavior in place.

https://stackoverflow.blog/2022/01/03/favor-real-dependencies-for-unit-testing/