Skip to content

Instantly share code, notes, and snippets.

@ppamorim
Created August 21, 2017 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppamorim/a4a1c7b2279c13ce2f86bf8f35b794b1 to your computer and use it in GitHub Desktop.
Save ppamorim/a4a1c7b2279c13ce2f86bf8f35b794b1 to your computer and use it in GitHub Desktop.
/**
* Just create a new project, add Realm dependency, enable minify (and add the Realm's proguard info) and run the test.
*/
@RunWith(AndroidJUnit4::class)
class RepositoryTest {
lateinit var realm: Realm
private fun cleanDatabase(realm: Realm) {
realm.executeTransaction {
realm.where(Task::class.java)
.findAll()
.deleteAllFromRealm()
}
}
@Before fun setUp() {
Realm.init(InstrumentationRegistry.getContext())
val stubbingConfiguration = RealmConfiguration.Builder()
.name("stubbing.realm")
.schemaVersion(14L)
.build()
realm = Realm.getInstance(stubbingConfiguration)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment