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 package org.moire.ultrasonic.cache
import com.nhaarman.mockito_kotlin.mock
import com.twitter.serial.util.SerializationUtils import com.twitter.serial.util.SerializationUtils
import java.io.File import java.io.File
import org.amshove.kluent.`it returns` import org.amshove.kluent.`it returns`
import org.junit.Before import org.junit.Before
import org.junit.Rule import org.junit.Rule
import org.junit.rules.TemporaryFolder import org.junit.rules.TemporaryFolder
import org.mockito.kotlin.mock
internal const val INTERNAL_DATA_FOLDER = "data" internal const val INTERNAL_DATA_FOLDER = "data"
internal const val INTERNAL_CACHE_FOLDER = "cache" internal const val INTERNAL_CACHE_FOLDER = "cache"

View File

@ -1,10 +1,10 @@
package org.moire.ultrasonic.api.subsonic 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.amshove.kluent.`should throw`
import org.junit.Test 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_1_0
import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions.V1_2_0 import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions.V1_2_0
import org.moire.ultrasonic.api.subsonic.models.AlbumListType.BY_GENRE 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.JsonParseException
import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.databind.DeserializationContext 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 be`
import org.amshove.kluent.`should throw` import org.amshove.kluent.`should throw`
import org.junit.Before import org.junit.Before
import org.junit.Test 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. * Unit test for [SubsonicAPIVersions.SubsonicAPIVersionsDeserializer] class.

View File

@ -1,9 +1,9 @@
package org.moire.ultrasonic.api.subsonic.interceptors package org.moire.ultrasonic.api.subsonic.interceptors
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.verify
import okhttp3.Interceptor.Chain import okhttp3.Interceptor.Chain
import org.junit.Test 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_12_0
import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions.V1_13_0 import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions.V1_13_0
import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions.V1_16_0 import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions.V1_16_0

View File

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

View File

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