Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e518dbb1 authored by Liran Binyamin's avatar Liran Binyamin Committed by Android (Google) Code Review
Browse files

Merge "Convert BubbleDataRepositoryTest to use mockito-kotlin" into udc-qpr-dev

parents 46a47c18 625a23ff
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ android_test {
        "frameworks-base-testutils",
        "kotlinx-coroutines-android",
        "kotlinx-coroutines-core",
        "mockito-kotlin2",
        "mockito-target-extended-minus-junit4",
        "truth-prebuilt",
        "testables",
+7 −10
Original line number Diff line number Diff line
@@ -29,11 +29,11 @@ import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Before
import org.junit.Test
import org.mockito.Mockito
import org.mockito.Mockito.mock
import org.mockito.Mockito.never
import org.mockito.Mockito.spy
import org.mockito.Mockito.verify
import org.mockito.kotlin.any
import org.mockito.kotlin.mock
import org.mockito.kotlin.never
import org.mockito.kotlin.spy
import org.mockito.kotlin.verify

class BubbleDataRepositoryTest : ShellTestCase() {

@@ -124,7 +124,7 @@ class BubbleDataRepositoryTest : ShellTestCase() {

    private val testHandler = Handler(Looper.getMainLooper())
    private val mainExecutor = HandlerExecutor(testHandler)
    private val launcherApps = mock(LauncherApps::class.java)
    private val launcherApps = mock<LauncherApps>()

    private val persistedBubbles = SparseArray<List<BubbleEntity>>()

@@ -158,8 +158,7 @@ class BubbleDataRepositoryTest : ShellTestCase() {
        assertThat(persistedBubbles).isEqualTo(validEntitiesByUser)

        // No invalid users, so no persist to disk happened
        verify(dataRepository, never()).persistToDisk(
            any(SparseArray<List<BubbleEntity>>()::class.java))
        verify(dataRepository, never()).persistToDisk(any())
    }

    @Test
@@ -199,6 +198,4 @@ class BubbleDataRepositoryTest : ShellTestCase() {
        // Verify that persist to disk happened with the new valid entities list.
        verify(dataRepository).persistToDisk(validEntitiesByUser)
    }

    fun <T> any(type: Class<T>): T = Mockito.any<T>(type)
}
 No newline at end of file