Currently, i'm trying to add ParentModule to SubModule but the problem is I got some unused @Provider methods even I use it.
Here's my code
public class DaggerTest extends TestCase {
@Inject
Random random;
public void testInjectRandomNotNull() {
ObjectGraph moduleGraph = ObjectGraph.create(new ParentModule());
ObjectGraph subModuleGraph = moduleGraph.plus(new SubModule());
subModuleGraph.inject(this);
assertNotNull(random);
}
@Module()
public class ParentModule {
@Provides
@Singleton
public Random provideRandom() {
return new Random();
}
}
@Module(addsTo = ParentModule.class, injects = {DaggerTest.class})
public class SubModule {
}
}