use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class QueryBuilderSimpleTest method testNotIn.
public void testNotIn() {
ArrayList<TestEntity> inserted = insert(5);
String value1 = getSimpleString(0);
String value2 = getSimpleString(2);
String value3 = getSimpleString(4);
List<TestEntity> result = dao.queryBuilder().where(Properties.SimpleString.notIn(value1, value2, value3)).orderAsc(Properties.SimpleString).list();
assertEquals(2, result.size());
TestEntity resultEntity1 = result.get(0);
assertEquals(inserted.get(1).getId(), resultEntity1.getId());
TestEntity resultEntity2 = result.get(1);
assertEquals(inserted.get(3).getId(), resultEntity2.getId());
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class QueryForThreadTest method testGetForCurrentThread_ParametersAreReset.
public void testGetForCurrentThread_ParametersAreReset() {
insert(3);
int value = getSimpleInteger(1);
Query<TestEntity> query = dao.queryBuilder().where(Properties.SimpleInteger.eq(value)).build();
query.setParameter(0, value + 1);
TestEntity entityFor2 = query.unique();
assertEquals(value + 1, (int) entityFor2.getSimpleInteger());
query = query.forCurrentThread();
assertNotNull(query.unique());
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RawQueryTest method testRawQueryEqualsString.
public void testRawQueryEqualsString() {
ArrayList<TestEntity> inserted = insert(3);
String value = getSimpleString(1);
String sql = "WHERE " + Properties.SimpleString.columnName + "=?";
List<TestEntity> result = dao.queryRawCreate(sql, value).list();
assertEquals(1, result.size());
TestEntity resultEntity = result.get(0);
assertEquals(value, resultEntity.getSimpleString());
assertEquals(inserted.get(1).getId(), resultEntity.getId());
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method testInsertOrReplace.
public void testInsertOrReplace() {
TestEntity foo = insertEntity("foo");
foo.setSimpleStringNotNull("bar");
assertUpdatedEntity(foo, rxDao.insertOrReplace(foo));
}
use of org.greenrobot.greendao.daotest.TestEntity in project greenDAO by greenrobot.
the class RxDaoTest method testInsertOrReplaceInTxList.
public void testInsertOrReplaceInTxList() {
TestEntity foo = insertEntity("foo");
TestEntity bar = insertEntity("bar");
foo.setSimpleStringNotNull("foo2");
List<TestEntity> list = new ArrayList<>();
list.add(foo);
list.add(bar);
assertUpdatedEntities(list, rxDao.insertOrReplaceInTx(list));
}
Aggregations