Releases: juanmendez/realm-tester
Updated gradle, and fixed a bug with realmObject.isValid()
v0.11 updated RealmObject as valid when created or updated, and false when …
RealmAnnotations + realmQuery.copyToRealmOrUpdate
This is a new class created to keep a hold of annotations from your realmModel|realmObject classes. I came with this solution as I cannot use reflection and figure out annotations of retention class types. How this is implemented can be found on the demo application.
Because now I can track @PrimaryKey, then I can go ahead and also update realmModels. This test can be found in the demo in class QueryTests.java, at method shouldUpdate()
not()
One of the greatest challenges I had was to apply not() within a group. This feature has been added, tested, and completed. Besides not(), other methods such as notEqualTo(), isNotNull(), isNotEmpty(), are behind the curtains using not() as not().isEqualTo().
realmQuery.distinct(), realmQuery.sort(), realmResults.sort()
user can now sort, and also us distinct. realmResults.distinct( field1, field2), or realmResults.distinct(field1).distinct(field2), do the same thing, as the result is finding realmModels which are unique having field1, and field2. This is what makes sense, but I also noticed Realm might behave a bit differently.
realmResults.sort(field1, field2), it is sorted in reverse order. First field2, and then field1. That's how it's done by Realm during testing I could confirm that is what happened.
realmResults.distinct("age",....)
Now we can find distinct values in realmResults. I noticed that having several distinct fields in Realm only returns the distinct values of the first field. So I am mocking what Realm is currently doing. This release can revert this effect when Realm goes the same route.
I am including console logs with prefix #mockingrealm, and make the developer aware of anything during test which does not comply with Realm.
Here is a demo:
#mocking-realm: ensure 'Dog.name' has @index annotation
#mocking-realm: ensure 'Dog.birthdate' has @index annotation
By the way due to the @index annotation not being retained at runtime , I cannot use reflection to check for class members having such annotation. So I am letting the developer aware at the console.
Realm 3.0.0 has this method already marked as deprecated. So this is going to stay here as I support this older version. I found it beneficial to first cover realmResults before moving into realmQuery.distinct(Async).
RealmConfigurations
They only have to be placed in a dependency away from any Android component; otherwise, during testing they should be skipped.
Update *async methods, addChangeListeners, and asObservables
At this point changeListeners are working as expected.
findAllAsync, findFirstAsync are working and also changeListeners can be attached
What is needed now is to test more in regards to unsubscribing changeListeners, and rxObservables.
first phase of realmQuery.*Async() methods, and realmQuery.asObservable()
realmQuery.findAllAsync(), realmQuery.findFirstAsync(), realmQuery.asObservable()
Starting with *Async methods
v0.03 fixes
robolectric:3.3.1
The current pre-release uses the latest version up to date of Robolectric.