diff options
| author | Harsh Shandilya <me@msfjarvis.dev> | 2022-07-15 00:53:48 +0530 |
|---|---|---|
| committer | Harsh Shandilya <me@msfjarvis.dev> | 2022-07-15 01:13:47 +0530 |
| commit | 549ee790d3e52bc62565ddf92e6a556e98b5195e (patch) | |
| tree | d5758e5eb80093704e683c8da926838e18182588 /coroutine-utils-testing/src/main/kotlin/dev/msfjarvis/aps | |
| parent | 010c6e227c9cc27f4d01bc912311f977b2aeb3a7 (diff) | |
| download | HardenedPass-549ee790d3e52bc62565ddf92e6a556e98b5195e.tar.gz HardenedPass-549ee790d3e52bc62565ddf92e6a556e98b5195e.zip | |
all: re-do package structure yet again
Diffstat (limited to 'coroutine-utils-testing/src/main/kotlin/dev/msfjarvis/aps')
| -rw-r--r-- | coroutine-utils-testing/src/main/kotlin/dev/msfjarvis/aps/test/CoroutineTestRule.kt | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/coroutine-utils-testing/src/main/kotlin/dev/msfjarvis/aps/test/CoroutineTestRule.kt b/coroutine-utils-testing/src/main/kotlin/dev/msfjarvis/aps/test/CoroutineTestRule.kt deleted file mode 100644 index 58ac48c9..00000000 --- a/coroutine-utils-testing/src/main/kotlin/dev/msfjarvis/aps/test/CoroutineTestRule.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ - -package dev.msfjarvis.aps.test - -import dev.msfjarvis.aps.util.coroutines.DispatcherProvider -import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.test.TestCoroutineScheduler -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 - -/** - * JUnit [TestWatcher] to correctly handle setting and resetting a given [testDispatcher] for tests. - */ -@ExperimentalCoroutinesApi -public class CoroutineTestRule( - public val testDispatcher: TestDispatcher = UnconfinedTestDispatcher(TestCoroutineScheduler()), -) : TestWatcher() { - - public val testDispatcherProvider: DispatcherProvider = - object : DispatcherProvider { - override fun default(): CoroutineDispatcher = testDispatcher - override fun io(): CoroutineDispatcher = testDispatcher - override fun main(): CoroutineDispatcher = testDispatcher - override fun unconfined(): CoroutineDispatcher = testDispatcher - } - - override fun starting(description: Description) { - super.starting(description) - Dispatchers.setMain(testDispatcher) - } - - override fun finished(description: Description) { - super.finished(description) - Dispatchers.resetMain() - } -} |
