A mocking library for Sugar ORM Also known as Splenda
Sugar ORM is an Object Relational Mapper for Android, allowing developers to persist and load POJOs in Android code using an embedded SQLite database.
SugarMock is a mock implementation of SugarOrm, which when included instead of the real library, allows population of test data for unit tests without requiring a real database, and allows assertion of ORM calls in tests. The builds so far are against v1.2 of Sugar ORM.
- Implemented findByQuery, with ability to pre-populate results
- Migrated build to gradle
In your Android project's build.gradle, include SugarMock jar instead of SugarORM for the testCompile phase.
We build with gradle, but unfortunately the android.jar dependency isn't available in any public maven repos. To build, copy android.jar from your sdk into the libs folder (we've tested against android-19 so far).
- Ability to test calls to save()
- More advanced usage of findWithQuery(), e.g. assert query string and params, and return different lists based on both