mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-16 03:30:50 +01:00
Fixed ktlint errors
This commit is contained in:
parent
ca2bfbf14b
commit
0f42ee20cc
@ -1,7 +1,5 @@
|
|||||||
package org.moire.ultrasonic.api.subsonic
|
package org.moire.ultrasonic.api.subsonic
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper
|
|
||||||
import okhttp3.mockwebserver.MockResponse
|
|
||||||
import org.amshove.kluent.`should be`
|
import org.amshove.kluent.`should be`
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -9,18 +7,18 @@ import org.junit.Test
|
|||||||
/**
|
/**
|
||||||
* Integration test for [VersionAwareJacksonConverterFactory].
|
* Integration test for [VersionAwareJacksonConverterFactory].
|
||||||
*/
|
*/
|
||||||
class VersionAwareJacksonConverterFactoryTest : SubsonicAPIClientTest() {
|
class VersionAwareJacksonConverterFactoryTest : SubsonicAPIClientTest() {
|
||||||
private val initialProtocolVersion = SubsonicAPIVersions.V1_1_0
|
private val initialProtocolVersion = SubsonicAPIVersions.V1_1_0
|
||||||
private var updatedProtocolVersion = SubsonicAPIVersions.V1_1_0
|
private var updatedProtocolVersion = SubsonicAPIVersions.V1_1_0
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
override fun setUp() {
|
override fun setUp() {
|
||||||
config = SubsonicClientConfiguration(
|
config = SubsonicClientConfiguration(
|
||||||
mockWebServerRule.mockWebServer.url("/").toString(),
|
mockWebServerRule.mockWebServer.url("/").toString(),
|
||||||
USERNAME,
|
USERNAME,
|
||||||
PASSWORD,
|
PASSWORD,
|
||||||
initialProtocolVersion,
|
initialProtocolVersion,
|
||||||
CLIENT_ID
|
CLIENT_ID
|
||||||
)
|
)
|
||||||
client = SubsonicAPIClient(config)
|
client = SubsonicAPIClient(config)
|
||||||
}
|
}
|
||||||
@ -51,4 +49,4 @@ class VersionAwareJacksonConverterFactoryTest : SubsonicAPIClientTest() {
|
|||||||
|
|
||||||
client.protocolVersion.`should be`(initialProtocolVersion)
|
client.protocolVersion.`should be`(initialProtocolVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,7 @@ package org.moire.ultrasonic.api.subsonic.interceptors
|
|||||||
|
|
||||||
import kotlin.LazyThreadSafetyMode.NONE
|
import kotlin.LazyThreadSafetyMode.NONE
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.mockwebserver.MockResponse
|
|
||||||
import org.amshove.kluent.`should contain`
|
import org.amshove.kluent.`should contain`
|
||||||
import org.amshove.kluent.`should equal`
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||||
import org.moire.ultrasonic.api.subsonic.enqueueResponse
|
import org.moire.ultrasonic.api.subsonic.enqueueResponse
|
||||||
|
@ -41,7 +41,7 @@ enum class SubsonicAPIVersions(val subsonicVersions: String, val restApiVersion:
|
|||||||
val majorVersion = versionComponents[0].toInt()
|
val majorVersion = versionComponents[0].toInt()
|
||||||
val minorVersion = versionComponents[1].toInt()
|
val minorVersion = versionComponents[1].toInt()
|
||||||
val patchVersion = if (versionComponents.size > 2) versionComponents[2].toInt()
|
val patchVersion = if (versionComponents.size > 2) versionComponents[2].toInt()
|
||||||
else 0
|
else 0
|
||||||
|
|
||||||
when (majorVersion) {
|
when (majorVersion) {
|
||||||
1 -> when {
|
1 -> when {
|
||||||
|
@ -18,11 +18,15 @@ class SubsonicAPIVersionsTest(private val apiVersion: SubsonicAPIVersions) {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Should proper convert api version to enum`() {
|
fun `Should proper convert api version to enum`() {
|
||||||
SubsonicAPIVersions.getClosestKnownClientApiVersion(apiVersion.restApiVersion) `should equal` apiVersion
|
SubsonicAPIVersions.getClosestKnownClientApiVersion(
|
||||||
|
apiVersion.restApiVersion
|
||||||
|
) `should equal` apiVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException::class)
|
@Test(expected = IllegalArgumentException::class)
|
||||||
fun `Should throw IllegalArgumentException for unknown api version`() {
|
fun `Should throw IllegalArgumentException for unknown api version`() {
|
||||||
SubsonicAPIVersions.getClosestKnownClientApiVersion(apiVersion.restApiVersion.substring(0, 2))
|
SubsonicAPIVersions.getClosestKnownClientApiVersion(
|
||||||
|
apiVersion.restApiVersion.substring(0, 2)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user