use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method testLoad.
public void testLoad() {
TestEntity foo = insertEntity("foo");
TestSubscriber<TestEntity> testSubscriber = RxTestHelper.awaitTestSubscriber(rxDao.load(foo.getId()));
assertEquals(1, testSubscriber.getValueCount());
TestEntity foo2 = testSubscriber.getOnNextEvents().get(0);
assertEquals(foo.getSimpleStringNotNull(), foo2.getSimpleStringNotNull());
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method testUpdateInTx.
public void testUpdateInTx() {
TestEntity foo = insertEntity("foo");
TestEntity bar = insertEntity("bar");
foo.setSimpleStringNotNull("foo2");
bar.setSimpleStringNotNull("bar2");
assertUpdatedEntities(foo, bar, rxDao.updateInTx(foo, bar));
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method testSaveInTxList.
public void testSaveInTxList() {
TestEntity foo = insertEntity("foo");
TestEntity bar = insertEntity("bar");
foo.setSimpleStringNotNull("foo2");
List<TestEntity> list = new ArrayList<>();
list.add(foo);
list.add(bar);
assertUpdatedEntities(list, rxDao.saveInTx(list));
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method assertUpdatedEntity.
private void assertUpdatedEntity(TestEntity foo, Observable<TestEntity> observable) {
TestSubscriber<TestEntity> testSubscriber = RxTestHelper.awaitTestSubscriber(observable);
assertEquals(1, testSubscriber.getValueCount());
TestEntity bar = testSubscriber.getOnNextEvents().get(0);
assertSame(foo, bar);
List<TestEntity> all = dao.loadAll();
assertEquals(1, all.size());
assertEquals(foo.getSimpleStringNotNull(), all.get(0).getSimpleStringNotNull());
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method testUpdateInTxList.
public void testUpdateInTxList() {
TestEntity foo = insertEntity("foo");
TestEntity bar = insertEntity("bar");
foo.setSimpleStringNotNull("foo2");
bar.setSimpleStringNotNull("bar2");
List<TestEntity> list = new ArrayList<>();
list.add(foo);
list.add(bar);
assertUpdatedEntities(list, rxDao.updateInTx(list));
}
Aggregations