public void testNullToNonNullResults() { RealmResults<AllTypes> resultList = testRealm.where(AllTypes.class).findAll(); RealmAdapter realmAdapter = new RealmAdapter(getContext(), null, automaticUpdate); realmAdapter.updateRealmResults(resultList); assertEquals(TEST_DATA_SIZE, realmAdapter.getCount()); }
public void testEmptyRealmResult() { RealmResults<AllTypes> resultList = testRealm.where(AllTypes.class).equalTo(FIELD_STRING, "Not there").findAll(); RealmAdapter realmAdapter = new RealmAdapter(getContext(), resultList, automaticUpdate); assertEquals(0, realmAdapter.getRealmResults().size()); assertEquals(0, realmAdapter.getCount()); }
public void testClearFromAdapter() { RealmResults<AllTypes> resultList = testRealm.where(AllTypes.class).findAll(); RealmAdapter realmAdapter = new RealmAdapter(getContext(), resultList, automaticUpdate); testRealm.beginTransaction(); realmAdapter.getRealmResults().clear(); testRealm.commitTransaction(); assertEquals(0, realmAdapter.getCount()); assertEquals(0, resultList.size()); }
public void testRemoveFromAdapter() { RealmResults<AllTypes> resultList = testRealm.where(AllTypes.class).findAll(); RealmAdapter realmAdapter = new RealmAdapter(getContext(), resultList, automaticUpdate); testRealm.beginTransaction(); realmAdapter.getRealmResults().remove(0); testRealm.commitTransaction(); assertEquals(TEST_DATA_SIZE - 1, realmAdapter.getCount()); resultList = testRealm.where(AllTypes.class).equalTo(FIELD_STRING, "test data 0").findAll(); assertEquals(0, resultList.size()); }
public void testNullResults() { RealmAdapter realmAdapter = new RealmAdapter(getContext(), null, automaticUpdate); assertEquals(0, realmAdapter.getCount()); }