Merge pull request #515 from ultrasonic/dependabot/gradle/versions.mockito-3.11.0
Bump versions.mockito from 3.8.0 to 3.11.0
This commit is contained in:
commit
dd1f55a927
|
@ -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"
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -35,8 +35,8 @@ ext.versions = [
|
||||||
|
|
||||||
junit4 : "4.13.2",
|
junit4 : "4.13.2",
|
||||||
junit5 : "5.7.1",
|
junit5 : "5.7.1",
|
||||||
mockito : "3.8.0",
|
mockito : "3.11.0",
|
||||||
mockitoKotlin : "1.5.0",
|
mockitoKotlin : "3.2.0",
|
||||||
kluent : "1.64",
|
kluent : "1.64",
|
||||||
apacheCodecs : "1.15",
|
apacheCodecs : "1.15",
|
||||||
robolectric : "4.5.1",
|
robolectric : "4.5.1",
|
||||||
|
@ -97,7 +97,7 @@ ext.testing = [
|
||||||
junit : "junit:junit:$versions.junit4",
|
junit : "junit:junit:$versions.junit4",
|
||||||
junitVintage : "org.junit.vintage:junit-vintage-engine:$versions.junit5",
|
junitVintage : "org.junit.vintage:junit-vintage-engine:$versions.junit5",
|
||||||
kotlinJunit : "org.jetbrains.kotlin:kotlin-test-junit:$versions.kotlin",
|
kotlinJunit : "org.jetbrains.kotlin:kotlin-test-junit:$versions.kotlin",
|
||||||
mockitoKotlin : "com.nhaarman:mockito-kotlin:$versions.mockitoKotlin",
|
mockitoKotlin : "org.mockito.kotlin:mockito-kotlin:$versions.mockitoKotlin",
|
||||||
mockito : "org.mockito:mockito-core:$versions.mockito",
|
mockito : "org.mockito:mockito-core:$versions.mockito",
|
||||||
mockitoInline : "org.mockito:mockito-inline:$versions.mockito",
|
mockitoInline : "org.mockito:mockito-inline:$versions.mockito",
|
||||||
kluent : "org.amshove.kluent:kluent:$versions.kluent",
|
kluent : "org.amshove.kluent:kluent:$versions.kluent",
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue