use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method testSave.
public void testSave() {
TestEntity foo = insertEntity("foo");
foo.setSimpleStringNotNull("bar");
assertUpdatedEntity(foo, rxDao.save(foo));
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method testDeleteInTxList.
public void testDeleteInTxList() {
TestEntity foo = insertEntity("foo");
TestEntity bar = insertEntity("bar");
List<TestEntity> list = new ArrayList<>();
list.add(foo);
list.add(bar);
assertDeleted(rxDao.deleteInTx(list));
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method testDelete.
public void testDelete() {
TestEntity foo = insertEntity("foo");
assertDeleted(rxDao.delete(foo));
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method assertUpdatedEntities.
private void assertUpdatedEntities(List<TestEntity> entities, Observable<List<TestEntity>> observable) {
TestEntity foo = entities.get(0);
TestEntity bar = entities.get(1);
TestSubscriber<List<TestEntity>> testSubscriber = RxTestHelper.awaitTestSubscriber(observable);
assertEquals(1, testSubscriber.getValueCount());
List<TestEntity> result = testSubscriber.getOnNextEvents().get(0);
assertSame(foo, result.get(0));
assertSame(bar, result.get(1));
List<TestEntity> all = dao.loadAll();
assertEquals(2, all.size());
assertEquals(foo.getSimpleStringNotNull(), all.get(0).getSimpleStringNotNull());
assertEquals(bar.getSimpleStringNotNull(), all.get(1).getSimpleStringNotNull());
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class TestEntityIdentityScopeTest method testDetachAll.
public void testDetachAll() {
TestEntity entity1 = createEntity(null);
TestEntity entity2 = createEntity(null);
dao.insertInTx(entity1, entity2);
dao.detachAll();
TestEntity entity1a = dao.load(entity1.getId());
TestEntity entity2a = dao.load(entity2.getId());
assertNotSame(entity1, entity1a);
assertNotSame(entity2, entity2a);
}
Aggregations