Skip to content
Snippets Groups Projects
Commit 225fffa6 authored by Habib Kazemi's avatar Habib Kazemi Committed by Geoffrey Métais
Browse files

Add InstantTaskExecutorRule to androidTest


without that the getValue() throws "java.lang.IllegalStateException: Cannot
invoke observeForever on a background thread"

Signed-off-by: default avatarGeoffrey Métais <geoffrey.metais@gmail.com>
parent 15282d90
No related branches found
No related tags found
No related merge requests found
Pipeline #4503 passed with stage
in 3 minutes and 49 seconds
......@@ -21,6 +21,7 @@
package org.videolan.vlc.database
import androidx.arch.core.executor.testing.CountingTaskExecutorRule
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.room.Room
import androidx.test.InstrumentationRegistry
import org.junit.After
......@@ -30,6 +31,9 @@ import java.util.concurrent.TimeUnit
abstract class DbTest {
@get:Rule
var instantTaskExecutorRule = InstantTaskExecutorRule()
@Rule
@JvmField
val countingTaskExecutorRule = CountingTaskExecutorRule()
......
......@@ -25,6 +25,7 @@ import androidx.room.Room
import androidx.room.migration.Migration
import androidx.room.testing.MigrationTestHelper
import android.net.Uri
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.test.InstrumentationRegistry
import androidx.test.runner.AndroidJUnit4
import org.hamcrest.CoreMatchers.`is`
......@@ -48,6 +49,9 @@ private const val TEST_DB_NAME = "test-db"
@RunWith(AndroidJUnit4::class)
class MigrationTest {
@get:Rule
var instantTaskExecutorRule = InstantTaskExecutorRule()
@get:Rule
val migrationTestHelper = MigrationTestHelper(
InstrumentationRegistry.getInstrumentation(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment