diff --git a/app/src/robolectricTest/java/org/fnives/test/showcase/storage/favourite/FavouriteContentLocalStorageImplInstrumentedTest.kt b/app/src/robolectricTest/java/org/fnives/test/showcase/storage/favourite/FavouriteContentLocalStorageImplInstrumentedTest.kt index ae52bb0..7ee1696 100644 --- a/app/src/robolectricTest/java/org/fnives/test/showcase/storage/favourite/FavouriteContentLocalStorageImplInstrumentedTest.kt +++ b/app/src/robolectricTest/java/org/fnives/test/showcase/storage/favourite/FavouriteContentLocalStorageImplInstrumentedTest.kt @@ -6,7 +6,6 @@ import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.take import kotlinx.coroutines.flow.toList import kotlinx.coroutines.test.StandardTestDispatcher -import kotlinx.coroutines.test.TestCoroutineScheduler import kotlinx.coroutines.test.TestDispatcher import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest @@ -36,7 +35,7 @@ internal class FavouriteContentLocalStorageImplInstrumentedTest( @Before fun setUp() { - testDispatcher = StandardTestDispatcher(TestCoroutineScheduler()) + testDispatcher = StandardTestDispatcher() DatabaseInitialization.dispatcher = testDispatcher sut = favouriteContentLocalStorageFactory() } diff --git a/app/src/robolectricTest/java/org/fnives/test/showcase/ui/RobolectricAuthActivityInstrumentedTest.kt b/app/src/robolectricTest/java/org/fnives/test/showcase/ui/RobolectricAuthActivityInstrumentedTest.kt index ec43a9b..5ec50d1 100644 --- a/app/src/robolectricTest/java/org/fnives/test/showcase/ui/RobolectricAuthActivityInstrumentedTest.kt +++ b/app/src/robolectricTest/java/org/fnives/test/showcase/ui/RobolectricAuthActivityInstrumentedTest.kt @@ -7,7 +7,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher -import kotlinx.coroutines.test.TestCoroutineScheduler import kotlinx.coroutines.test.TestDispatcher import kotlinx.coroutines.test.resetMain import kotlinx.coroutines.test.setMain @@ -43,7 +42,7 @@ class RobolectricAuthActivityInstrumentedTest : KoinTest { @Before fun setup() { Intents.init() - val dispatcher = StandardTestDispatcher(TestCoroutineScheduler()) + val dispatcher = StandardTestDispatcher() Dispatchers.setMain(dispatcher) testDispatcher = dispatcher DatabaseInitialization.dispatcher = dispatcher diff --git a/app/src/sharedTest/java/org/fnives/test/showcase/testutils/idling/MainDispatcherTestRule.kt b/app/src/sharedTest/java/org/fnives/test/showcase/testutils/idling/MainDispatcherTestRule.kt index 029caed..6553624 100644 --- a/app/src/sharedTest/java/org/fnives/test/showcase/testutils/idling/MainDispatcherTestRule.kt +++ b/app/src/sharedTest/java/org/fnives/test/showcase/testutils/idling/MainDispatcherTestRule.kt @@ -3,7 +3,6 @@ package org.fnives.test.showcase.testutils.idling import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher -import kotlinx.coroutines.test.TestCoroutineScheduler import kotlinx.coroutines.test.TestDispatcher import kotlinx.coroutines.test.resetMain import kotlinx.coroutines.test.setMain @@ -22,7 +21,7 @@ class MainDispatcherTestRule : TestRule { object : Statement() { @Throws(Throwable::class) override fun evaluate() { - val dispatcher = StandardTestDispatcher(TestCoroutineScheduler()) + val dispatcher = StandardTestDispatcher() Dispatchers.setMain(dispatcher) testDispatcher = dispatcher DatabaseInitialization.dispatcher = dispatcher diff --git a/app/src/test/java/org/fnives/test/showcase/testutils/TestMainDispatcher.kt b/app/src/test/java/org/fnives/test/showcase/testutils/TestMainDispatcher.kt index 3f1a454..42592a5 100644 --- a/app/src/test/java/org/fnives/test/showcase/testutils/TestMainDispatcher.kt +++ b/app/src/test/java/org/fnives/test/showcase/testutils/TestMainDispatcher.kt @@ -3,7 +3,6 @@ package org.fnives.test.showcase.testutils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher -import kotlinx.coroutines.test.TestCoroutineScheduler import kotlinx.coroutines.test.TestDispatcher import kotlinx.coroutines.test.resetMain import kotlinx.coroutines.test.setMain @@ -22,7 +21,7 @@ import org.junit.jupiter.api.extension.ExtensionContext class TestMainDispatcher : BeforeEachCallback, AfterEachCallback { override fun beforeEach(context: ExtensionContext?) { - val testDispatcher = StandardTestDispatcher(TestCoroutineScheduler()) + val testDispatcher = StandardTestDispatcher() privateTestDispatcher = testDispatcher DatabaseInitialization.dispatcher = testDispatcher Dispatchers.setMain(testDispatcher) diff --git a/codekata/robolectric.instructionset.md b/codekata/robolectric.instructionset.md index 9f4ffb0..c08eb3e 100644 --- a/codekata/robolectric.instructionset.md +++ b/codekata/robolectric.instructionset.md @@ -191,7 +191,7 @@ private lateinit var testDispatcher: TestDispatcher @Before fun setUp() { - testDispatcher = StandardTestDispatcher(TestCoroutineScheduler()) + testDispatcher = StandardTestDispatcher() DatabaseInitialization.dispatcher = testDispatcher } @@ -523,7 +523,7 @@ We use a TestDispatcher and initialize our database with it as well. @Before fun setup() { //... - val dispatcher = StandardTestDispatcher(TestCoroutineScheduler()) + val dispatcher = StandardTestDispatcher() Dispatchers.setMain(dispatcher) testDispatcher = dispatcher DatabaseInitialization.dispatcher = dispatcher