use of com.activeandroid.query.From in project ActiveAndroid by pardom.
the class CountTest method testCountOrderBy.
/**
* Should not change the result if order by is used.
*/
public void testCountOrderBy() {
cleanTable();
populateTable();
From from = new Select().from(MockModel.class).where("intField = ?", 1).orderBy("intField ASC");
final List<MockModel> list = from.execute();
final int count = from.count();
assertEquals(2, count);
assertEquals(list.size(), count);
}
use of com.activeandroid.query.From in project ActiveAndroid by pardom.
the class CountTest method testCountWhereClause.
/**
* Should return the same count as there are entries in the result set if the where-clause
* matches several entries.
*/
public void testCountWhereClause() {
cleanTable();
populateTable();
From from = new Select().from(MockModel.class).where("intField = ?", 1);
final List<MockModel> list = from.execute();
final int count = from.count();
assertEquals(2, count);
assertEquals(list.size(), count);
}
use of com.activeandroid.query.From in project ActiveAndroid by pardom.
the class CountTest method testCountTable.
/**
* Should return the same count as there are entries in the result set/table.
*/
public void testCountTable() {
cleanTable();
populateTable();
From from = new Select().from(MockModel.class);
final List<MockModel> list = from.execute();
final int count = from.count();
assertEquals(3, count);
assertEquals(list.size(), count);
}