Fix imports (ownership and thus package names have changed for Mockito-Kotlin)

This commit is contained in:
tzugen 2021-06-08 22:00:04 +02:00
parent 27f3d7c00c
commit 175f7cd6f6
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
6 changed files with 25 additions and 27 deletions

View File

@ -1,12 +1,12 @@
package org.moire.ultrasonic.cache
import com.nhaarman.mockito_kotlin.mock
import com.twitter.serial.util.SerializationUtils
import java.io.File
import org.amshove.kluent.`it returns`
import org.junit.Before
import org.junit.Rule
import org.junit.rules.TemporaryFolder
import org.mockito.kotlin.mock
internal const val INTERNAL_DATA_FOLDER = "data"
internal const val INTERNAL_CACHE_FOLDER = "cache"

View File

@ -1,10 +1,10 @@
package org.moire.ultrasonic.api.subsonic
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.never
import com.nhaarman.mockito_kotlin.verify
import org.amshove.kluent.`should throw`
import org.junit.Test
import org.mockito.Mockito.never
import org.mockito.Mockito.verify
import org.mockito.kotlin.mock
import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions.V1_1_0
import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions.V1_2_0
import org.moire.ultrasonic.api.subsonic.models.AlbumListType.BY_GENRE

View File

@ -3,13 +3,13 @@ package org.moire.ultrasonic.api.subsonic
import com.fasterxml.jackson.core.JsonParseException
import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.databind.DeserializationContext
import com.nhaarman.mockito_kotlin.doReturn
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.whenever
import org.amshove.kluent.`should be`
import org.amshove.kluent.`should throw`
import org.junit.Before
import org.junit.Test
import org.mockito.Mockito.doReturn
import org.mockito.kotlin.mock
import org.mockito.kotlin.whenever
/**
* Unit test for [SubsonicAPIVersions.SubsonicAPIVersionsDeserializer] class.

View File

@ -1,9 +1,9 @@
package org.moire.ultrasonic.api.subsonic.interceptors
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.verify
import okhttp3.Interceptor.Chain
import org.junit.Test
import org.mockito.Mockito.verify
import org.mockito.kotlin.mock
import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions.V1_12_0
import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions.V1_13_0
import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions.V1_16_0

View File

@ -1,9 +1,6 @@
package org.moire.ultrasonic.imageloader
import android.net.Uri
import com.nhaarman.mockito_kotlin.any
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.whenever
import com.squareup.picasso.Picasso
import com.squareup.picasso.Request
import org.amshove.kluent.`should be equal to`
@ -12,6 +9,9 @@ import org.amshove.kluent.`should throw`
import org.amshove.kluent.shouldBeEqualTo
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.mock
import org.mockito.kotlin.whenever
import org.moire.ultrasonic.api.subsonic.SubsonicAPIClient
import org.moire.ultrasonic.api.subsonic.response.StreamResponse
import org.robolectric.RobolectricTestRunner
@ -20,9 +20,8 @@ import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
@Config(manifest = Config.NONE)
class AvatarRequestHandlerTest {
private val mockSubsonicApiClient = mock<SubsonicAPIClient>()
private val handler =
AvatarRequestHandler(mockSubsonicApiClient)
private val mockApiClient: SubsonicAPIClient = mock()
private val handler = AvatarRequestHandler(mockApiClient)
@Test
fun `Should accept only cover art request`() {
@ -60,7 +59,7 @@ class AvatarRequestHandlerTest {
apiError = null,
responseHttpCode = 200
)
whenever(mockSubsonicApiClient.getAvatar(any()))
whenever(mockApiClient.getAvatar(any()))
.thenReturn(streamResponse)
val response = handler.load(

View File

@ -1,10 +1,6 @@
package org.moire.ultrasonic.imageloader
import android.net.Uri
import com.nhaarman.mockito_kotlin.any
import com.nhaarman.mockito_kotlin.anyOrNull
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.whenever
import com.squareup.picasso.Picasso
import com.squareup.picasso.Request
import java.io.IOException
@ -14,15 +10,18 @@ import org.amshove.kluent.`should throw`
import org.amshove.kluent.shouldBeEqualTo
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.mock
import org.mockito.kotlin.whenever
import org.moire.ultrasonic.api.subsonic.SubsonicAPIClient
import org.moire.ultrasonic.api.subsonic.response.StreamResponse
import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class)
class CoverArtRequestHandlerTest {
private val mockSubsonicApiClientMock = mock<SubsonicAPIClient>()
private val handler =
CoverArtRequestHandler(mockSubsonicApiClientMock)
private val mockApiClient: SubsonicAPIClient = mock()
private val handler = CoverArtRequestHandler(mockApiClient)
@Test
fun `Should accept only cover art request`() {
@ -56,8 +55,8 @@ class CoverArtRequestHandlerTest {
@Test
fun `Should throw IOException when request to api failed`() {
val streamResponse = StreamResponse(null, null, 500)
whenever(mockSubsonicApiClientMock.getCoverArt(any(), anyOrNull()))
.thenReturn(streamResponse)
whenever(mockApiClient.getCoverArt(any(), anyOrNull())).thenReturn(streamResponse)
val fail = {
handler.load(createLoadCoverArtRequest("some").buildRequest(), 0)
@ -73,8 +72,8 @@ class CoverArtRequestHandlerTest {
apiError = null,
responseHttpCode = 200
)
whenever(mockSubsonicApiClientMock.getCoverArt(any(), anyOrNull()))
.thenReturn(streamResponse)
whenever(mockApiClient.getCoverArt(any(), anyOrNull())).thenReturn(streamResponse)
val response = handler.load(
createLoadCoverArtRequest("some").buildRequest(), 0