Created
August 21, 2017 14:54
-
-
Save ppamorim/a4a1c7b2279c13ce2f86bf8f35b794b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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