Fix detekt issues.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2017-07-30 22:23:20 +02:00
parent 07c2bfaeaf
commit 317ccd2ed8
24 changed files with 28 additions and 27 deletions

View File

@ -30,6 +30,7 @@ import java.util.TimeZone
/** /**
* Integration test for [SubsonicAPIClient] class. * Integration test for [SubsonicAPIClient] class.
*/ */
@Suppress("TooManyFunctions")
class SubsonicAPIClientTest { class SubsonicAPIClientTest {
companion object { companion object {
const val USERNAME = "some-user" const val USERNAME = "some-user"
@ -49,7 +50,7 @@ class SubsonicAPIClientTest {
} }
@Test @Test
fun `Should pass password hash and salt in query params for api version 1_13_0`() { fun `Should pass password hash and salt in query params for api version 1 13 0`() {
val clientV12 = SubsonicAPIClient(mockWebServerRule.mockWebServer.url("/").toString(), USERNAME, val clientV12 = SubsonicAPIClient(mockWebServerRule.mockWebServer.url("/").toString(), USERNAME,
PASSWORD, SubsonicAPIVersions.V1_14_0, CLIENT_ID) PASSWORD, SubsonicAPIVersions.V1_14_0, CLIENT_ID)
enqueueResponse("ping_ok.json") enqueueResponse("ping_ok.json")
@ -70,7 +71,7 @@ class SubsonicAPIClientTest {
} }
@Test @Test
fun `Should pass hex encoded password in query params for api version 1_12_0`() { fun `Should pass hex encoded password in query params for api version 1 12 0`() {
val clientV11 = SubsonicAPIClient(mockWebServerRule.mockWebServer.url("/").toString(), USERNAME, val clientV11 = SubsonicAPIClient(mockWebServerRule.mockWebServer.url("/").toString(), USERNAME,
PASSWORD, SubsonicAPIVersions.V1_12_0, CLIENT_ID) PASSWORD, SubsonicAPIVersions.V1_12_0, CLIENT_ID)
enqueueResponse("ping_ok.json") enqueueResponse("ping_ok.json")
@ -153,7 +154,7 @@ class SubsonicAPIClientTest {
@Test @Test
fun `Should parse get indexes ok response`() { fun `Should parse get indexes ok response`() {
// TODO: check for shortcut parsing // check for shortcut parsing
enqueueResponse("get_indexes_ok.json") enqueueResponse("get_indexes_ok.json")
val response = client.api.getIndexes(null, null).execute() val response = client.api.getIndexes(null, null).execute()
@ -303,4 +304,4 @@ class SubsonicAPIClientTest {
version `should be` SubsonicAPIVersions.V1_13_0 version `should be` SubsonicAPIVersions.V1_13_0
error `should be` null error `should be` null
} }
} }

View File

@ -24,4 +24,4 @@ class MockWebServerRule : TestRule {
} }
return ruleStatement return ruleStatement
} }
} }

View File

@ -110,4 +110,4 @@ class SubsonicAPIClient(baseUrl: String,
this.addQueryParameter("s", salt) this.addQueryParameter("s", salt)
} }
} }
} }

View File

@ -30,4 +30,4 @@ interface SubsonicAPIDefinition {
@GET("getMusicDirectory.view") @GET("getMusicDirectory.view")
fun getMusicDirectory(@Query("id") id: Long): Call<GetMusicDirectoryResponse> fun getMusicDirectory(@Query("id") id: Long): Call<GetMusicDirectoryResponse>
} }

View File

@ -61,4 +61,4 @@ enum class SubsonicAPIVersions(val subsonicVersions: String, val restApiVersion:
} }
} }
} }
} }

View File

@ -35,4 +35,4 @@ enum class SubsonicError(val code: Int) {
} }
} }
} }
} }

View File

@ -4,4 +4,4 @@ import java.util.Calendar
data class Artist(val id: Long, data class Artist(val id: Long,
val name: String, val name: String,
val starred: Calendar?) val starred: Calendar?)

View File

@ -4,4 +4,4 @@ import com.fasterxml.jackson.annotation.JsonProperty
data class Index(val name: String, data class Index(val name: String,
@JsonProperty("artist") @JsonProperty("artist")
val artists: List<Artist>) val artists: List<Artist>)

View File

@ -6,4 +6,4 @@ data class Indexes(val lastModified: Long,
val ignoredArticles: String?, val ignoredArticles: String?,
@JsonProperty("index") @JsonProperty("index")
val indexList: List<Index>, val indexList: List<Index>,
val shortcuts: List<Index>?) val shortcuts: List<Index>?)

View File

@ -6,4 +6,4 @@ data class License(
val valid: Boolean = false, val valid: Boolean = false,
val email: String = "", val email: String = "",
val trialExpires: Calendar = Calendar.getInstance(), val trialExpires: Calendar = Calendar.getInstance(),
val licenseExpires: Calendar = Calendar.getInstance()) val licenseExpires: Calendar = Calendar.getInstance())

View File

@ -7,4 +7,4 @@ data class MusicDirectory(val id: Long,
val name: String, val name: String,
val starred: Calendar?, val starred: Calendar?,
@JsonProperty("child") @JsonProperty("child")
val childList: List<MusicDirectoryChild> = emptyList()) val childList: List<MusicDirectoryChild> = emptyList())

View File

@ -6,4 +6,4 @@ data class MusicDirectoryChild(val id: Long, val parent: Long, val isDir: Boolea
val title: String = "", val album: String = "", val title: String = "", val album: String = "",
val artist: String = "", val year: Int?, val artist: String = "", val year: Int?,
val genre: String = "", val coverArt: Long = -1, val genre: String = "", val coverArt: Long = -1,
val created: Calendar, val starred: Calendar?) val created: Calendar, val starred: Calendar?)

View File

@ -1,3 +1,3 @@
package org.moire.ultrasonic.api.subsonic.models package org.moire.ultrasonic.api.subsonic.models
data class MusicFolder(val id: Long = -1, val name: String = "") data class MusicFolder(val id: Long = -1, val name: String = "")

View File

@ -8,4 +8,4 @@ class GetIndexesResponse(status: Status,
version: SubsonicAPIVersions, version: SubsonicAPIVersions,
error: SubsonicError?, error: SubsonicError?,
val indexes: Indexes?) : val indexes: Indexes?) :
SubsonicResponse(status, version, error) SubsonicResponse(status, version, error)

View File

@ -10,4 +10,4 @@ class GetMusicDirectoryResponse(status: Status,
error: SubsonicError?, error: SubsonicError?,
@JsonProperty("directory") @JsonProperty("directory")
val musicDirectory: MusicDirectory?) : val musicDirectory: MusicDirectory?) :
SubsonicResponse(status, version, error) SubsonicResponse(status, version, error)

View File

@ -8,4 +8,4 @@ class LicenseResponse(val license: License = License(),
status: Status, status: Status,
version: SubsonicAPIVersions, version: SubsonicAPIVersions,
error: SubsonicError?) : error: SubsonicError?) :
SubsonicResponse(status, version, error) SubsonicResponse(status, version, error)

View File

@ -30,4 +30,4 @@ class MusicFoldersResponse(status: Status,
} }
} }
} }
} }

View File

@ -36,4 +36,4 @@ open class SubsonicResponse(val status: Status,
} }
} }
} }
} }

View File

@ -41,4 +41,4 @@ class SubsonicAPIVersionsDeserializerTest {
parsedVersion `should be` SubsonicAPIVersions.V1_13_0 parsedVersion `should be` SubsonicAPIVersions.V1_13_0
} }
} }

View File

@ -25,4 +25,4 @@ class SubsonicAPIVersionsTest(private val apiVersion: SubsonicAPIVersions) {
fun `Should throw IllegalArgumentException for unknown api version`() { fun `Should throw IllegalArgumentException for unknown api version`() {
SubsonicAPIVersions.fromApiVersion(apiVersion.restApiVersion.substring(0, 2)) SubsonicAPIVersions.fromApiVersion(apiVersion.restApiVersion.substring(0, 2))
} }
} }

View File

@ -25,4 +25,4 @@ class SubsonicErrorTest(private val error: SubsonicError) {
fun `Should throw IllegalArgumentException from unknown error code`() { fun `Should throw IllegalArgumentException from unknown error code`() {
SubsonicError.parseErrorFromJson(error.code + 10000) SubsonicError.parseErrorFromJson(error.code + 10000)
} }
} }

View File

@ -26,4 +26,4 @@ class StatusTest(private val status: SubsonicResponse.Status) {
fun `Should throw IllegalArgumentException on unknown status`() { fun `Should throw IllegalArgumentException on unknown status`() {
SubsonicResponse.Status.getStatusFromJson(status.jsonValue.plus("-some")) SubsonicResponse.Status.getStatusFromJson(status.jsonValue.plus("-some"))
} }
} }

View File

@ -12,4 +12,4 @@ fun convertMusicFolder(entity: APIMusicFolder): MusicFolder {
fun convertMusicFolderList(entitiesList: List<APIMusicFolder>): List<MusicFolder> { fun convertMusicFolderList(entitiesList: List<APIMusicFolder>): List<MusicFolder> {
return entitiesList.map { convertMusicFolder(it) } return entitiesList.map { convertMusicFolder(it) }
} }

View File

@ -40,4 +40,4 @@ class APIConverterTest {
private fun createMusicFolder(id: Long = 0, name: String = ""): MusicFolder = private fun createMusicFolder(id: Long = 0, name: String = ""): MusicFolder =
MusicFolder(id, name) MusicFolder(id, name)
} }