use of org.greenrobot.greendao.daotest.RelationEntity in project greenDAO by greenrobot.
the class RelationEntityTest method testToOneNoMatchLoadDeep.
public void testToOneNoMatchLoadDeep() {
RelationEntity entity = insertEntityWithRelations(42l);
assertNotNull(entity.getTestEntity());
entity.setTestId(23l);
entity.setTestIdNotNull(-78);
dao.update(entity);
entity = dao.loadDeep(entity.getId());
assertNull(entity.getTestEntity());
assertNull(entity.getTestNotNull());
}
use of org.greenrobot.greendao.daotest.RelationEntity in project greenDAO by greenrobot.
the class RelationEntityTest method testToOneNoMatch.
public void testToOneNoMatch() {
RelationEntity entity = insertEntityWithRelations(42l);
assertNotNull(entity.getTestEntity());
entity.setTestId(23l);
entity.setTestIdNotNull(-78);
assertNull(entity.getTestEntity());
assertNull(entity.getTestNotNull());
}
use of org.greenrobot.greendao.daotest.RelationEntity in project greenDAO by greenrobot.
the class RelationEntityTest method testToOneUpdateEntity.
public void testToOneUpdateEntity() {
RelationEntity entity = insertEntityWithRelations(42l);
TestEntity testEntity = entity.getTestEntity();
RelationEntity entity2 = insertEntityWithRelations(43l);
TestEntity testEntity2 = entity2.getTestEntity();
entity.setTestEntity(testEntity2);
assertEquals(testEntity2.getId(), entity.getTestId());
entity.setTestEntity(null);
assertNull(entity.getTestId());
entity.setTestEntity(testEntity);
assertEquals(testEntity.getId(), entity.getTestId());
}
use of org.greenrobot.greendao.daotest.RelationEntity in project greenDAO by greenrobot.
the class RelationEntityTestIdentityScope method testToQueryDeepIdentityScope.
public void testToQueryDeepIdentityScope() {
insertEntityWithRelations(42l);
RelationEntity entity2 = insertEntityWithRelations(42l);
String columnName = RelationEntityDao.Properties.SimpleString.columnName;
List<RelationEntity> entityList = dao.queryDeep("WHERE T." + columnName + "=?", "findMe");
assertEquals(2, entityList.size());
RelationEntity entity = entityList.get(0);
assertTestEntity(entity);
entity2 = entityList.get(1);
assertTestEntity(entity2);
assertSame(entity.getTestEntity(), entity2.getTestEntity());
}
use of org.greenrobot.greendao.daotest.RelationEntity in project greenDAO by greenrobot.
the class RelationEntityTestIdentityScope method testLoadDeepIdentityScope.
public void testLoadDeepIdentityScope() {
RelationEntity entity = insertEntityWithRelations(42l);
RelationEntity entity2 = dao.loadDeep(entity.getId());
RelationEntity entity3 = dao.loadDeep(entity.getId());
assertSame(entity, entity2);
assertSame(entity, entity3);
assertTestEntity(entity);
}
Aggregations