Remove deprecations from tests

This commit is contained in:
Mikołaj Pich 2022-07-30 16:48:58 +02:00
parent 953233590b
commit aec4ea5221
3 changed files with 1 additions and 36 deletions

View file

@ -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

View file

@ -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()
}
}

View file

@ -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) {