Overusing mocking with π Dependency Injection defeats the purpose of writing Unit Tests because refactoring the underlying code usually leads to having to refactor the Unit Tests. This is because the dependency is hidden away through Dependency Injection, and any dependencies are supposed to be mocked away in unit tests.
I feel like this is related to using a layered architecture, but Iβm having a hard time putting it into words.
Continue on this thought, I think there is more here and that the current architecture is questionable. The biggest issue is when part of the implementation depends on a dependency that has been injected. This injected dependency forces the newly created class to also be created through dependency injection (not strictly speaking, but itβs the βusualβ way of doing things), forcing a re-write of all unit tests.
Instead of defining the inputs of each class through dependency injection, each module should expose a single interface. The top-level definition of other modules has to depend on that interface and underlying classes are constructed with the dependencies passed through the top level.