mirror of https://github.com/tasks/tasks
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
659 B
Kotlin
24 lines
659 B
Kotlin
package org.tasks.injection
|
|
|
|
import android.content.Context
|
|
import androidx.test.core.app.ApplicationProvider.getApplicationContext
|
|
import androidx.test.platform.app.InstrumentationRegistry
|
|
import dagger.hilt.android.testing.HiltAndroidRule
|
|
import org.junit.Before
|
|
import org.junit.Rule
|
|
|
|
abstract class InjectingTestCase {
|
|
@get:Rule
|
|
var hiltRule = HiltAndroidRule(this)
|
|
|
|
@Before
|
|
open fun setUp() {
|
|
hiltRule.inject()
|
|
}
|
|
|
|
protected fun runOnMainSync(runnable: Runnable) =
|
|
InstrumentationRegistry.getInstrumentation().runOnMainSync(runnable)
|
|
|
|
protected val context: Context
|
|
get() = getApplicationContext()
|
|
} |