Issue#11 Add annotation @OptIn(ExperimentalCoroutinesApi::class) where its needed

This commit is contained in:
Gergely Hegedus 2022-01-23 23:21:16 +02:00
parent a71fa67de2
commit e9a22dd60a
14 changed files with 27 additions and 1 deletions

View file

@ -29,7 +29,7 @@ class ShadowSnackbar {
@Implementation @Implementation
@JvmStatic @JvmStatic
fun make(view: View, text: CharSequence, duration: Int): Snackbar? { fun make(view: View, text: CharSequence, duration: Int): Snackbar? {
var snackbar: Snackbar? = null val snackbar: Snackbar?
try { try {
val constructor = Snackbar::class.java.getDeclaredConstructor( val constructor = Snackbar::class.java.getDeclaredConstructor(
Context::class.java, Context::class.java,

View file

@ -1,5 +1,6 @@
package org.fnives.test.showcase.ui.auth package org.fnives.test.showcase.ui.auth
import kotlinx.coroutines.ExperimentalCoroutinesApi
import org.fnives.test.showcase.core.login.LoginUseCase import org.fnives.test.showcase.core.login.LoginUseCase
import org.fnives.test.showcase.testutils.InstantExecutorExtension import org.fnives.test.showcase.testutils.InstantExecutorExtension
import org.fnives.test.showcase.testutils.TestMainDispatcher import org.fnives.test.showcase.testutils.TestMainDispatcher
@ -12,6 +13,7 @@ import org.mockito.kotlin.mock
@Disabled("CodeKata") @Disabled("CodeKata")
@ExtendWith(InstantExecutorExtension::class, TestMainDispatcher::class) @ExtendWith(InstantExecutorExtension::class, TestMainDispatcher::class)
@OptIn(ExperimentalCoroutinesApi::class)
class CodeKataAuthViewModel { class CodeKataAuthViewModel {
private lateinit var sut: AuthViewModel private lateinit var sut: AuthViewModel

View file

@ -1,5 +1,6 @@
package org.fnives.test.showcase.core.content package org.fnives.test.showcase.core.content
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorage import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorage
@ -17,6 +18,7 @@ import org.mockito.kotlin.verifyZeroInteractions
import org.mockito.kotlin.whenever import org.mockito.kotlin.whenever
@Suppress("TestFunctionName") @Suppress("TestFunctionName")
@OptIn(ExperimentalCoroutinesApi::class)
internal class AddContentToFavouriteUseCaseTest { internal class AddContentToFavouriteUseCaseTest {
private lateinit var sut: AddContentToFavouriteUseCase private lateinit var sut: AddContentToFavouriteUseCase

View file

@ -1,5 +1,6 @@
package org.fnives.test.showcase.core.content package org.fnives.test.showcase.core.content
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Disabled
@ -7,6 +8,7 @@ import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@Disabled("CodeKata") @Disabled("CodeKata")
@OptIn(ExperimentalCoroutinesApi::class)
class CodeKataContentRepositoryTest { class CodeKataContentRepositoryTest {
@BeforeEach @BeforeEach

View file

@ -1,6 +1,7 @@
package org.fnives.test.showcase.core.content package org.fnives.test.showcase.core.content
import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async import kotlinx.coroutines.async
import kotlinx.coroutines.flow.take import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.toList import kotlinx.coroutines.flow.toList
@ -28,6 +29,7 @@ import org.mockito.kotlin.verifyNoMoreInteractions
import org.mockito.kotlin.whenever import org.mockito.kotlin.whenever
@Suppress("TestFunctionName") @Suppress("TestFunctionName")
@OptIn(ExperimentalCoroutinesApi::class)
internal class ContentRepositoryTest { internal class ContentRepositoryTest {
private lateinit var sut: ContentRepository private lateinit var sut: ContentRepository

View file

@ -1,5 +1,6 @@
package org.fnives.test.showcase.core.content package org.fnives.test.showcase.core.content
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Assertions.assertThrows
@ -15,6 +16,7 @@ import org.mockito.kotlin.verifyZeroInteractions
import org.mockito.kotlin.whenever import org.mockito.kotlin.whenever
@Suppress("TestFunctionName") @Suppress("TestFunctionName")
@OptIn(ExperimentalCoroutinesApi::class)
internal class FetchContentUseCaseTest { internal class FetchContentUseCaseTest {
private lateinit var sut: FetchContentUseCase private lateinit var sut: FetchContentUseCase

View file

@ -1,5 +1,6 @@
package org.fnives.test.showcase.core.content package org.fnives.test.showcase.core.content
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async import kotlinx.coroutines.async
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.take import kotlinx.coroutines.flow.take
@ -21,6 +22,7 @@ import org.mockito.kotlin.mock
import org.mockito.kotlin.whenever import org.mockito.kotlin.whenever
@Suppress("TestFunctionName") @Suppress("TestFunctionName")
@OptIn(ExperimentalCoroutinesApi::class)
internal class GetAllContentUseCaseTest { internal class GetAllContentUseCaseTest {
private lateinit var sut: GetAllContentUseCase private lateinit var sut: GetAllContentUseCase

View file

@ -1,5 +1,6 @@
package org.fnives.test.showcase.core.content package org.fnives.test.showcase.core.content
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorage import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorage
@ -17,6 +18,7 @@ import org.mockito.kotlin.verifyZeroInteractions
import org.mockito.kotlin.whenever import org.mockito.kotlin.whenever
@Suppress("TestFunctionName") @Suppress("TestFunctionName")
@OptIn(ExperimentalCoroutinesApi::class)
internal class RemoveContentFromFavouritesUseCaseTest { internal class RemoveContentFromFavouritesUseCaseTest {
private lateinit var sut: RemoveContentFromFavouritesUseCase private lateinit var sut: RemoveContentFromFavouritesUseCase

View file

@ -2,6 +2,7 @@ package org.fnives.test.showcase.core.content
import app.cash.turbine.test import app.cash.turbine.test
import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.take import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.toList import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.UnconfinedTestDispatcher
@ -26,6 +27,7 @@ import org.mockito.kotlin.verify
import org.mockito.kotlin.verifyNoMoreInteractions import org.mockito.kotlin.verifyNoMoreInteractions
import org.mockito.kotlin.whenever import org.mockito.kotlin.whenever
@OptIn(ExperimentalCoroutinesApi::class)
class TurbineContentRepositoryTest { class TurbineContentRepositoryTest {
private lateinit var sut: ContentRepository private lateinit var sut: ContentRepository

View file

@ -1,6 +1,7 @@
package org.fnives.test.showcase.core.content package org.fnives.test.showcase.core.content
import app.cash.turbine.test import app.cash.turbine.test
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorage import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorage
@ -17,6 +18,7 @@ import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock import org.mockito.kotlin.mock
import org.mockito.kotlin.whenever import org.mockito.kotlin.whenever
@OptIn(ExperimentalCoroutinesApi::class)
class TurbineGetAllContentUseCaseTest { class TurbineGetAllContentUseCaseTest {
private lateinit var sut: GetAllContentUseCase private lateinit var sut: GetAllContentUseCase

View file

@ -1,5 +1,6 @@
package org.fnives.test.showcase.core.login package org.fnives.test.showcase.core.login
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.fnives.test.showcase.core.shared.UnexpectedException import org.fnives.test.showcase.core.shared.UnexpectedException
import org.fnives.test.showcase.core.storage.UserDataLocalStorage import org.fnives.test.showcase.core.storage.UserDataLocalStorage
@ -23,6 +24,7 @@ import org.mockito.kotlin.verifyZeroInteractions
import org.mockito.kotlin.whenever import org.mockito.kotlin.whenever
@Suppress("TestFunctionName") @Suppress("TestFunctionName")
@OptIn(ExperimentalCoroutinesApi::class)
internal class LoginUseCaseTest { internal class LoginUseCaseTest {
private lateinit var sut: LoginUseCase private lateinit var sut: LoginUseCase

View file

@ -1,5 +1,6 @@
package org.fnives.test.showcase.core.login.hilt package org.fnives.test.showcase.core.login.hilt
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.fnives.test.showcase.core.content.ContentRepository import org.fnives.test.showcase.core.content.ContentRepository
import org.fnives.test.showcase.core.login.LogoutUseCase import org.fnives.test.showcase.core.login.LogoutUseCase
@ -16,6 +17,7 @@ import org.mockito.kotlin.verifyZeroInteractions
import javax.inject.Inject import javax.inject.Inject
@Suppress("TestFunctionName") @Suppress("TestFunctionName")
@OptIn(ExperimentalCoroutinesApi::class)
internal class LogoutUseCaseTest { internal class LogoutUseCaseTest {
@Inject @Inject

View file

@ -1,5 +1,6 @@
package org.fnives.test.showcase.core.login.koin package org.fnives.test.showcase.core.login.koin
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.fnives.test.showcase.core.content.ContentRepository import org.fnives.test.showcase.core.content.ContentRepository
import org.fnives.test.showcase.core.di.koin.createCoreModule import org.fnives.test.showcase.core.di.koin.createCoreModule
@ -21,6 +22,7 @@ import org.mockito.kotlin.verifyNoMoreInteractions
import org.mockito.kotlin.verifyZeroInteractions import org.mockito.kotlin.verifyZeroInteractions
@Suppress("TestFunctionName") @Suppress("TestFunctionName")
@OptIn(ExperimentalCoroutinesApi::class)
internal class LogoutUseCaseTest : KoinTest { internal class LogoutUseCaseTest : KoinTest {
private lateinit var sut: LogoutUseCase private lateinit var sut: LogoutUseCase

View file

@ -1,6 +1,7 @@
package org.fnives.test.showcase.core.shared package org.fnives.test.showcase.core.shared
import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.fnives.test.showcase.model.shared.Answer import org.fnives.test.showcase.model.shared.Answer
@ -12,6 +13,7 @@ import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@Suppress("TestFunctionName") @Suppress("TestFunctionName")
@OptIn(ExperimentalCoroutinesApi::class)
internal class AnswerUtilsKtTest { internal class AnswerUtilsKtTest {
@DisplayName("GIVEN network exception thrown WHEN wrapped into answer THEN answer error is returned") @DisplayName("GIVEN network exception thrown WHEN wrapped into answer THEN answer error is returned")