use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class TestEntityIdentityScopeTest method testLoadAllScope.
public void testLoadAllScope() {
TestEntity entity = createEntity(null);
dao.insert(entity);
TestEntity entity2 = dao.loadAll().get(0);
TestEntity entity3 = dao.loadAll().get(0);
assertSame(entity, entity2);
assertSame(entity2, entity3);
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class TestEntityTest method createEntity.
@Override
protected TestEntity createEntity(Long key) {
TestEntity entity = new TestEntity();
entity.setId(key);
entity.setSimpleStringNotNull("green");
return entity;
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class TestEntityTestBase method createEntity.
protected TestEntity createEntity(int simpleInteger, String simpleString) {
TestEntity entity = new TestEntity();
entity.setId(null);
entity.setSimpleStringNotNull("green");
entity.setSimpleInteger(simpleInteger);
entity.setSimpleString(simpleString);
return entity;
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RelationEntityTest method assertTestEntity.
protected void assertTestEntity(RelationEntity entity) {
TestEntity testEntity = entity.getTestEntity();
assertNotNull(testEntity);
assertEquals(42l, (long) testEntity.getId());
assertEquals("mytest", testEntity.getSimpleStringNotNull());
assertEquals("I'm a parent", entity.getParent().getSimpleString());
assertEquals(entity.getParentId(), entity.getParent().getId());
assertNotNull(entity.getTestNotNull());
}
use of org.greenrobot.greendao.daotest.TestEntity 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());
}
Aggregations