use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class TestEntityIdentityScopeTest method testLoadIdScope.
public void testLoadIdScope() {
TestEntity entity = createEntity(null);
dao.insert(entity);
TestEntity entity2 = dao.load(entity.getId());
TestEntity entity3 = dao.load(entity.getId());
assertSame(entity, entity2);
assertSame(entity2, entity3);
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class TestEntityTest method testRefreshIllegal.
public void testRefreshIllegal() {
TestEntity entity = createEntity(1l);
try {
dao.refresh(entity);
fail("Exception expected");
} catch (DaoException expected) {
}
dao.insert(entity);
dao.delete(entity);
try {
dao.refresh(entity);
fail("Exception expected");
} catch (DaoException expected) {
}
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class TestEntityTest method testRefresh.
public void testRefresh() {
TestEntity entity = createEntity(1l);
entity.setSimpleInteger(42);
entity.setSimpleString(null);
dao.insert(entity);
entity.setSimpleInteger(null);
entity.setSimpleString("temp");
dao.refresh(entity);
assertEquals(42, (int) entity.getSimpleInteger());
assertNull(entity.getSimpleString());
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class TestEntityTestBase method assertIds.
protected void assertIds(List<TestEntity> list, List<TestEntity> list2) {
for (int i = 0; i < list.size(); i++) {
TestEntity entity = list.get(i);
TestEntity lazyEntity = list2.get(i);
assertIds(entity, lazyEntity);
}
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class TestEntityTestBase method insert.
protected ArrayList<TestEntity> insert(int count) {
ArrayList<TestEntity> list = new ArrayList<TestEntity>();
for (int i = 0; i < count; i++) {
TestEntity entity = createEntity(getSimpleInteger(i), getSimpleString(i));
list.add(entity);
}
dao.insertInTx(list);
return list;
}
Aggregations