diff --git a/app/build.gradle b/app/build.gradle index 97fe769..5d861bd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -74,7 +74,7 @@ dependencies { implementation 'com.android.support:design:28.0.0' // todo: firebase app distribution testImplementation 'junit:junit:4.12' - testImplementation 'org.mockito:mockito-all:2.0.2-beta' + testImplementation 'org.mockito:mockito-core:5.11.0' androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) diff --git a/app/src/main/java/com/vgaidarji/cimatters/LoginPresenter.kt b/app/src/main/java/com/vgaidarji/cimatters/LoginPresenter.kt index 1b232f5..dd22df2 100644 --- a/app/src/main/java/com/vgaidarji/cimatters/LoginPresenter.kt +++ b/app/src/main/java/com/vgaidarji/cimatters/LoginPresenter.kt @@ -1,10 +1,7 @@ package com.vgaidarji.cimatters -import android.util.Log - internal class LoginPresenter(private val view: LoginView) { fun onLoginClick(email: String, password: String) { - Log.d("test123","email + ${email}, password + ${password}, ${email == EMAIL && password == PASSWORD}") if (email == EMAIL && password == PASSWORD) { view.openNextActivity() } else { diff --git a/app/src/test/java/com/vgaidarji/cimatters/LoginPresenterTest.kt b/app/src/test/java/com/vgaidarji/cimatters/LoginPresenterTest.kt index ec03fb3..43c10d4 100644 --- a/app/src/test/java/com/vgaidarji/cimatters/LoginPresenterTest.kt +++ b/app/src/test/java/com/vgaidarji/cimatters/LoginPresenterTest.kt @@ -2,8 +2,8 @@ package com.vgaidarji.cimatters import org.junit.Before import org.junit.Test -import org.mockito.Matchers -import org.mockito.Mockito +import org.mockito.ArgumentMatchers +import org.mockito.Mockito.* class LoginPresenterTest { private lateinit var view: LoginView @@ -11,7 +11,7 @@ class LoginPresenterTest { @Before @Throws(Exception::class) fun setUp() { - view = Mockito.mock(LoginView::class.java) + view = mock(LoginView::class.java) presenter = LoginPresenter(view) } @@ -19,13 +19,13 @@ class LoginPresenterTest { @Throws(Exception::class) fun onLoginClick_shouldOpenNextActivityForAllowedCredentials() { presenter!!.onLoginClick("test@test.com", "1111") - Mockito.verify(view)?.openNextActivity() + verify(view)?.openNextActivity() } @Test @Throws(Exception::class) fun onLoginClick_shouldShowErrorForIncorrectCredentials() { presenter!!.onLoginClick("wrong@email.com", "not_a_password") - Mockito.verify(view)?.showError(Matchers.anyString()) + verify(view)?.showError(ArgumentMatchers.anyString()) } }