PR#98 Fix code analysis errors

This commit is contained in:
Gergely Hegedus 2022-07-12 11:58:02 +03:00
parent 7e019973e8
commit 8ec369f3e7
9 changed files with 14 additions and 18 deletions

View file

@ -1,8 +1,8 @@
package org.fnives.test.showcase.di
import android.content.Context
import org.fnives.test.showcase.model.network.BaseUrl
import org.fnives.test.showcase.android.testutil.StandardTestMainDispatcher
import org.fnives.test.showcase.model.network.BaseUrl
import org.fnives.test.showcase.ui.auth.AuthViewModel
import org.fnives.test.showcase.ui.home.MainViewModel
import org.fnives.test.showcase.ui.splash.SplashViewModel

View file

@ -4,11 +4,11 @@ import com.jraska.livedata.test
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.runBlocking
import org.fnives.test.showcase.android.testutil.InstantExecutorExtension
import org.fnives.test.showcase.android.testutil.StandardTestMainDispatcher
import org.fnives.test.showcase.core.login.LoginUseCase
import org.fnives.test.showcase.model.auth.LoginCredentials
import org.fnives.test.showcase.model.auth.LoginStatus
import org.fnives.test.showcase.model.shared.Answer
import org.fnives.test.showcase.android.testutil.StandardTestMainDispatcher
import org.fnives.test.showcase.ui.shared.Event
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
@ -44,11 +44,6 @@ internal class AuthViewModelTest {
@DisplayName("GIVEN initialized viewModel WHEN observed THEN loading false other fields are empty")
@Test
fun initialSetup() {
var a = ""
repeat(1200 / 2) {
a += "a "
}
System.err.println(a+"b")
val usernameTestObserver = sut.username.test()
val passwordTestObserver = sut.password.test()
val loadingTestObserver = sut.loading.test()
@ -174,7 +169,7 @@ internal class AuthViewModelTest {
@ParameterizedTest(name = "GIVEN answer success loginStatus {0} WHEN login called THEN error {1} is shown")
fun invalidStatusResultsInErrorState(
loginStatus: LoginStatus,
errorType: AuthViewModel.ErrorType
errorType: AuthViewModel.ErrorType,
) {
runBlocking {
whenever(mockLoginUseCase.invoke(anyOrNull())).doReturn(Answer.Success(loginStatus))

View file

@ -2,8 +2,8 @@ package org.fnives.test.showcase.ui.auth
import kotlinx.coroutines.ExperimentalCoroutinesApi
import org.fnives.test.showcase.android.testutil.InstantExecutorExtension
import org.fnives.test.showcase.core.login.LoginUseCase
import org.fnives.test.showcase.android.testutil.StandardTestMainDispatcher
import org.fnives.test.showcase.core.login.LoginUseCase
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test

View file

@ -5,6 +5,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.runBlocking
import org.fnives.test.showcase.android.testutil.InstantExecutorExtension
import org.fnives.test.showcase.android.testutil.StandardTestMainDispatcher
import org.fnives.test.showcase.core.content.AddContentToFavouriteUseCase
import org.fnives.test.showcase.core.content.FetchContentUseCase
import org.fnives.test.showcase.core.content.GetAllContentUseCase
@ -15,7 +16,6 @@ import org.fnives.test.showcase.model.content.ContentId
import org.fnives.test.showcase.model.content.FavouriteContent
import org.fnives.test.showcase.model.content.ImageUrl
import org.fnives.test.showcase.model.shared.Resource
import org.fnives.test.showcase.android.testutil.StandardTestMainDispatcher
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test

View file

@ -3,8 +3,8 @@ package org.fnives.test.showcase.ui.splash
import com.jraska.livedata.test
import kotlinx.coroutines.ExperimentalCoroutinesApi
import org.fnives.test.showcase.android.testutil.InstantExecutorExtension
import org.fnives.test.showcase.core.login.IsUserLoggedInUseCase
import org.fnives.test.showcase.android.testutil.StandardTestMainDispatcher
import org.fnives.test.showcase.core.login.IsUserLoggedInUseCase
import org.fnives.test.showcase.ui.shared.Event
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName

View file

@ -37,7 +37,7 @@ project.ext {
// ------------------VERSIONS------------------
def testing_junit5_version = propertyOrNull('junit5_version') ?: "5.7.0"
def testing_junit4_version = propertyOrNull('juni4_version') ?: "4.12"
def testing_junit4_version = propertyOrNull('juni4_version') ?: "4.13.2"
def testing_robolectric_version = propertyOrNull('robolectric_version') ?: "4.7"
def testing_androidx_code_version = propertyOrNull('androidx_test_version') ?: "1.4.0"
def testing_androidx_junit_version = propertyOrNull('androidx_junit_version') ?: "1.1.3"

View file

@ -1,7 +1,7 @@
project.ext {
androidx_core_version = "1.7.0"
androidx_core_version = "1.8.0"
androidx_appcompat_version = "1.4.1"
androidx_material_version = "1.5.0"
androidx_material_version = "1.6.1"
androidx_constraintlayout_version = "2.1.3"
androidx_livedata_version = "2.4.0"
androidx_swiperefreshlayout_version = "1.1.0"
@ -28,7 +28,7 @@ project.ext {
testing_kotlin_mockito_version = "4.0.0"
junit5_version = "5.7.0"
testing_json_assert_version = "1.5.0"
testing_junit4_version = "4.12"
testing_junit4_version = "4.13.2"
testing_robolectric_version = "4.7"
espresso_version = "3.4.0"
}

View file

@ -12,7 +12,8 @@ import org.junit.jupiter.api.extension.ExtensionContext
*
* reference: https://developer.android.com/reference/androidx/arch/core/executor/testing/InstantTaskExecutorRule
*
* A JUnit5 Extensions that swaps the background executor used by the Architecture Components with a different one which executes each task synchronously.
* A JUnit5 Extensions that swaps the background executor used by the Architecture Components with a different
* one which executes each task synchronously.
* You can use this extension for your host side tests that use Architecture Components.
*/
@SuppressLint("RestrictedApi")