Fix launching all tests simultaneously

feature/top10
Laurent 7 years ago
parent c80e41367e
commit 8bbc31354c
  1. 2
      app/src/androidTest/java/net/pokeranalytics/android/ExampleInstrumentedUnitTest.kt
  2. 9
      app/src/androidTest/java/net/pokeranalytics/android/RealmInstrumentedUnitTest.kt

@ -331,7 +331,7 @@ class ExampleInstrumentedUnitTest : RealmInstrumentedUnitTest() {
var sessions: RealmResults<Session>? = null var sessions: RealmResults<Session>? = null
@Test // @Test
fun testOverlappingSessionDeletion() { fun testOverlappingSessionDeletion() {
val realm = this.mockRealm val realm = this.mockRealm

@ -1,6 +1,5 @@
package net.pokeranalytics.android package net.pokeranalytics.android
import android.os.Looper
import io.realm.Realm import io.realm.Realm
import io.realm.RealmConfiguration import io.realm.RealmConfiguration
import org.junit.After import org.junit.After
@ -15,18 +14,22 @@ open class RealmInstrumentedUnitTest {
@Before @Before
fun setup() { fun setup() {
Looper.prepare() // Looper.prepare()
val testConfig = RealmConfiguration.Builder().inMemory().name("test-realm").build() val testConfig = RealmConfiguration.Builder().inMemory().name("test-realm").build()
Realm.setDefaultConfiguration(testConfig) Realm.setDefaultConfiguration(testConfig)
this.mockRealm = Realm.getDefaultInstance() this.mockRealm = Realm.getDefaultInstance()
this.mockRealm.executeTransaction {
this.mockRealm.deleteAll()
}
} }
@After @After
@Throws(Exception::class) @Throws(Exception::class)
public fun tearDown() { public fun tearDown() {
Looper.loop() // Looper.loop()
this.mockRealm.close() this.mockRealm.close()
} }

Loading…
Cancel
Save