use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method testInsertOrReplaceInTx.
public void testInsertOrReplaceInTx() {
TestEntity foo = insertEntity("foo");
TestEntity bar = insertEntity("bar");
foo.setSimpleStringNotNull("foo2");
assertUpdatedEntities(foo, bar, rxDao.insertOrReplaceInTx(foo, bar));
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method testInsertInTx.
public void testInsertInTx() {
TestEntity foo = RxTestHelper.createEntity("foo");
TestEntity bar = RxTestHelper.createEntity("bar");
TestSubscriber<Object[]> testSubscriber = RxTestHelper.awaitTestSubscriber(rxDao.insertInTx(foo, bar));
assertEquals(1, testSubscriber.getValueCount());
Object[] array = testSubscriber.getOnNextEvents().get(0);
assertSame(foo, array[0]);
assertSame(bar, array[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 RxDaoTest method testUpdate.
public void testUpdate() {
TestEntity foo = insertEntity("foo");
foo.setSimpleString("foofoo");
TestSubscriber testSubscriber = RxTestHelper.awaitTestSubscriber(rxDao.update(foo));
assertEquals(1, testSubscriber.getValueCount());
assertSame(foo, testSubscriber.getOnNextEvents().get(0));
List<TestEntity> testEntities = dao.loadAll();
assertEquals(1, testEntities.size());
assertNotSame(foo, testEntities.get(0));
assertEquals("foofoo", testEntities.get(0).getSimpleString());
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxTestHelper method createEntity.
static TestEntity createEntity(String simpleStringNotNull) {
TestEntity entity = new TestEntity();
entity.setSimpleStringNotNull(simpleStringNotNull);
return entity;
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxTestHelper method insertEntity.
static TestEntity insertEntity(TestEntityDao dao, String simpleStringNotNull) {
TestEntity entity = createEntity(simpleStringNotNull);
dao.insert(entity);
return entity;
}
Aggregations