我已经为房间数据库创建了dagger2模块,如下所示:
@Module
public class RoomModule {
@AppScope
@Provides
StateDataBase dbEngineerProvider(Context context){
return Room.databaseBuilder(context, StateDataBase.class, "State.db").build();
}
@AppScope
@Provides
UserDao getUserDao(StateDataBase db) {
return db.getUserDao();
}
}
我在应用程序类中初始化了匕首:
@Override
public void onCreate() {
super.onCreate();
Timber.plant(new Timber.DebugTree());
component = DaggerAppComponent.builder()
.networkModule(new NetworkModule(this))
.build();
}
public AppComponent getAppComponent() {
return component;
}
}
我想知道怎样才能从我房间的数据库中进行真正的测试而不是模拟测试?
我想在我的数据库中插入一个数据,在我的应用程序中我使用这个数据!!!!
例如,在测试中,我插入我的用户的用户名和密码,然后在运行应用程序时,我使用这些数据登录到应用程序!!有可能吗?