I am migrating from Dagger 2.0.2 to Dagger 2.12 and plan to utilize dagger.android API.
My question is about migrating the test code. Currently, I have an AppModule and a TestAppModule which extends it and overrides some dependencies using @Override annotation. Here is an example:
@Module
public class TestAppModule extends AppModule {
@Override
public UserDao provideUserDao() {
return mock(UserDao.class);
}
}
Now with Dagger 2.12, if I try overriding a dependency in
TestAppModule, an error is thrown: error: @Provides methods may not be overridden in modules.
What is the recommended way of overriding and mocking some of the dependencies in a TestModule while utilizing the rest of the dependencies defined in AppModule as is?
I can post a stripped down version of my Dagger setup if people think it's necessary.