Search in sources :

Example 66 with TestEntity

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);
}
Also used : TestEntity(org.greenrobot.greendao.daotest.TestEntity)

Example 67 with TestEntity

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;
}
Also used : TestEntity(org.greenrobot.greendao.daotest.TestEntity)

Example 68 with TestEntity

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;
}
Also used : TestEntity(org.greenrobot.greendao.daotest.TestEntity)

Example 69 with TestEntity

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());
}
Also used : TestEntity(org.greenrobot.greendao.daotest.TestEntity)

Example 70 with TestEntity

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());
}
Also used : TestEntity(org.greenrobot.greendao.daotest.TestEntity) RelationEntity(org.greenrobot.greendao.daotest.RelationEntity)

Aggregations

TestEntity (org.greenrobot.greendao.daotest.TestEntity)72 ArrayList (java.util.ArrayList)16 RelationEntity (org.greenrobot.greendao.daotest.RelationEntity)4 List (java.util.List)3 DaoException (org.greenrobot.greendao.DaoException)2 TestSubscriber (rx.observers.TestSubscriber)2 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 Date (java.util.Date)1 Map (java.util.Map)1 NoSuchElementException (java.util.NoSuchElementException)1 WhereCondition (org.greenrobot.greendao.query.WhereCondition)1 Subscription (rx.Subscription)1