diff options
Diffstat (limited to 'android/lib')
| -rw-r--r-- | android/lib/common-test/build.gradle.kts | 12 | ||||
| -rw-r--r-- | android/lib/common-test/src/main/java/net/mullvad/mullvadvpn/lib/common/test/TestCoroutineRule.kt | 14 |
2 files changed, 17 insertions, 9 deletions
diff --git a/android/lib/common-test/build.gradle.kts b/android/lib/common-test/build.gradle.kts index 3d0ef6c028..6e3fc7c02f 100644 --- a/android/lib/common-test/build.gradle.kts +++ b/android/lib/common-test/build.gradle.kts @@ -21,10 +21,20 @@ android { abortOnError = true warningsAsErrors = true } + + packaging { + resources { + pickFirsts += setOf( + // Fixes packaging error caused by: jetified-junit-* + "META-INF/LICENSE.md", + "META-INF/LICENSE-notice.md" + ) + } + } } dependencies { implementation(Dependencies.Kotlin.test) implementation(Dependencies.KotlinX.coroutinesTest) - implementation(Dependencies.junit) + implementation(Dependencies.junitApi) } diff --git a/android/lib/common-test/src/main/java/net/mullvad/mullvadvpn/lib/common/test/TestCoroutineRule.kt b/android/lib/common-test/src/main/java/net/mullvad/mullvadvpn/lib/common/test/TestCoroutineRule.kt index d04983be26..34d6739119 100644 --- a/android/lib/common-test/src/main/java/net/mullvad/mullvadvpn/lib/common/test/TestCoroutineRule.kt +++ b/android/lib/common-test/src/main/java/net/mullvad/mullvadvpn/lib/common/test/TestCoroutineRule.kt @@ -6,22 +6,20 @@ import kotlinx.coroutines.test.TestDispatcher import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.resetMain import kotlinx.coroutines.test.setMain -import org.junit.rules.TestWatcher -import org.junit.runner.Description +import org.junit.jupiter.api.extension.AfterEachCallback +import org.junit.jupiter.api.extension.BeforeEachCallback +import org.junit.jupiter.api.extension.ExtensionContext @OptIn(ExperimentalCoroutinesApi::class) class TestCoroutineRule(val testDispatcher: TestDispatcher = UnconfinedTestDispatcher()) : - TestWatcher() { + BeforeEachCallback, AfterEachCallback { - override fun starting(description: Description) { - super.starting(description) + override fun beforeEach(var1: ExtensionContext?) { Dispatchers.setMain(testDispatcher) } - override fun finished(description: Description) { - super.finished(description) + override fun afterEach(var1: ExtensionContext?) { Dispatchers.resetMain() - // Replacement for cleanupTestCoroutines() testDispatcher.scheduler.runCurrent() } } |
