From ff2cd70be89a26086058000ddb2d30f15195ee4e Mon Sep 17 00:00:00 2001 From: Alpar Szotyori Date: Thu, 18 Jan 2024 17:59:27 +0100 Subject: [PATCH] refactor(capture-sdk): Fix camera and onboarding tests BSDK-258 --- .../android/capture/camera/CameraFragmentImplTest.kt | 1 + .../onboarding/OnboardingScreenPresenterTest.kt | 11 +++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/capture-sdk/sdk/src/test/java/net/gini/android/capture/camera/CameraFragmentImplTest.kt b/capture-sdk/sdk/src/test/java/net/gini/android/capture/camera/CameraFragmentImplTest.kt index 7401dfa8e7..bfaf8c495f 100644 --- a/capture-sdk/sdk/src/test/java/net/gini/android/capture/camera/CameraFragmentImplTest.kt +++ b/capture-sdk/sdk/src/test/java/net/gini/android/capture/camera/CameraFragmentImplTest.kt @@ -107,6 +107,7 @@ class CameraFragmentImplTest { } } }) + whenever(fragmentCallbackStub.findNavController()).thenReturn(mock()) val fragmentImpl = CameraFragmentImpl(fragmentCallbackStub) diff --git a/capture-sdk/sdk/src/test/java/net/gini/android/capture/onboarding/OnboardingScreenPresenterTest.kt b/capture-sdk/sdk/src/test/java/net/gini/android/capture/onboarding/OnboardingScreenPresenterTest.kt index 093e0ece0c..e105e6906a 100644 --- a/capture-sdk/sdk/src/test/java/net/gini/android/capture/onboarding/OnboardingScreenPresenterTest.kt +++ b/capture-sdk/sdk/src/test/java/net/gini/android/capture/onboarding/OnboardingScreenPresenterTest.kt @@ -80,11 +80,9 @@ class OnboardingScreenPresenterTest { @Test @Throws(Exception::class) - fun `notify listener to close onboarding when show next page on last page was requested`() { + fun `notify view to close onboarding when show next page on last page was requested`() { // Given val presenter = createPresenter() - val listener = mock() - presenter.setListener(listener) // When val customPages: List = Lists.newArrayList( @@ -96,7 +94,7 @@ class OnboardingScreenPresenterTest { presenter.showNextPage() // Then - Mockito.verify(listener).onCloseOnboarding() + Mockito.verify(mView).close() } @Test @@ -241,14 +239,11 @@ class OnboardingScreenPresenterTest { // Given val presenter = createPresenter() - val listener = mock() - presenter.setListener(listener) - // When presenter.skip() // Then - verify(listener).onCloseOnboarding() + verify(mView).close() } @Test