I am looking for the best approach to inject mock dependencies instead of real once in the tested classes while i am running unit/integration tests. I have two issues: 1. With application scoped dependencies 2. With activity scoped dependencies.
With the first one I thought of the following approach: creating a test application class which extends the real application class and override all those methods who create or return the components and just to return mocked components instead.
With the second problem which is the biggest one i thought of creating testableClass for each class, override the function that calls dagger and just put mock logic there. The main issue with this approach is that I would need a testable class for every tested class which seems like a lot of overhead.
So far i failed to find a better solution, I would really love to hear your opinions.