From aec4ea5221edaedb076b86241136a5be56d6d53c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Sat, 30 Jul 2022 16:48:58 +0200 Subject: [PATCH] Remove deprecations from tests --- build.gradle | 2 +- .../sdk/scrapper/MainCoroutineRule.kt | 25 ------------------- .../interceptor/AutoLoginInterceptorTest.kt | 10 -------- 3 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 sdk-scrapper/src/test/kotlin/io/github/wulkanowy/sdk/scrapper/MainCoroutineRule.kt diff --git a/build.gradle b/build.gradle index 35c96b1e..a6463a66 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ ext { retrofit = "2.9.0" slf4j = "1.7.36" moshi = "1.13.0" - coroutines = "1.6.3" + coroutines = "1.6.4" } version = PUBLISH_VERSION diff --git a/sdk-scrapper/src/test/kotlin/io/github/wulkanowy/sdk/scrapper/MainCoroutineRule.kt b/sdk-scrapper/src/test/kotlin/io/github/wulkanowy/sdk/scrapper/MainCoroutineRule.kt deleted file mode 100644 index 88d2c529..00000000 --- a/sdk-scrapper/src/test/kotlin/io/github/wulkanowy/sdk/scrapper/MainCoroutineRule.kt +++ /dev/null @@ -1,25 +0,0 @@ -package io.github.wulkanowy.sdk.scrapper - -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.test.TestCoroutineDispatcher -import kotlinx.coroutines.test.resetMain -import kotlinx.coroutines.test.setMain -import org.junit.rules.TestWatcher -import org.junit.runner.Description - -@Suppress("EXPERIMENTAL_API_USAGE") -class MainCoroutineRule( - private val testDispatcher: TestCoroutineDispatcher = TestCoroutineDispatcher() -) : TestWatcher() { - - override fun starting(description: Description) { - super.starting(description) - Dispatchers.setMain(testDispatcher) - } - - override fun finished(description: Description) { - super.finished(description) - Dispatchers.resetMain() - testDispatcher.cleanupTestCoroutines() - } -} diff --git a/sdk-scrapper/src/test/kotlin/io/github/wulkanowy/sdk/scrapper/interceptor/AutoLoginInterceptorTest.kt b/sdk-scrapper/src/test/kotlin/io/github/wulkanowy/sdk/scrapper/interceptor/AutoLoginInterceptorTest.kt index d86c8076..967828e1 100644 --- a/sdk-scrapper/src/test/kotlin/io/github/wulkanowy/sdk/scrapper/interceptor/AutoLoginInterceptorTest.kt +++ b/sdk-scrapper/src/test/kotlin/io/github/wulkanowy/sdk/scrapper/interceptor/AutoLoginInterceptorTest.kt @@ -1,7 +1,6 @@ package io.github.wulkanowy.sdk.scrapper.interceptor import io.github.wulkanowy.sdk.scrapper.BaseLocalTest -import io.github.wulkanowy.sdk.scrapper.MainCoroutineRule import io.github.wulkanowy.sdk.scrapper.Scrapper import io.github.wulkanowy.sdk.scrapper.login.LoginHelper import io.github.wulkanowy.sdk.scrapper.login.LoginTest @@ -15,24 +14,15 @@ import kotlinx.coroutines.runBlocking import kotlinx.coroutines.supervisorScope import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue -import org.junit.Before -import org.junit.Rule import org.junit.Test import java.net.CookieManager class AutoLoginInterceptorTest : BaseLocalTest() { - @get:Rule - val coroutineRule = MainCoroutineRule() - lateinit var loginService: LoginService lateinit var loginHelper: LoginHelper - @Before - fun setUp() { - } - @Test fun oneLoginAtTime() = runBlocking { with(server) {