use of com.android.example.devsummit.archdemo.di.component.TestComponent in project dev-summit-architecture-demo by yigit.
the class TestUtil method prepare.
public static TestComponent prepare(App app) {
FlowManager.destroy();
resetSingleton(FlowManager.class, "mDatabaseHolder");
ApplicationModule appModule = new ApplicationModule(app) {
@Override
public EventBus eventBus() {
return new LoggingBus();
}
@Provides
@Singleton
public JobManager jobManager() {
JobManager mock = mock(JobManager.class);
when(mock.addJob(any(Job.class))).thenReturn(1L);
return mock;
}
};
TestComponent testComponent = DaggerTestComponent.builder().testApplicationModule(new TestApplicationModule()).applicationModule(appModule).build();
testComponent.appContext().deleteDatabase(DemoDatabase.NAME + ".db");
FlowManager.init(app);
testComponent.feedModel().clear();
testComponent.loggingBus().clear();
return testComponent;
}
Aggregations