Update KtLint to 0.14.0 version.

Also fix style problems.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2017-12-21 10:44:19 +01:00
parent 11c1b92098
commit 07802e9206
26 changed files with 135 additions and 99 deletions

View File

@ -5,7 +5,7 @@ ext.versions = [
gradle : '4.4.1',
androidTools : "3.0.1",
ktlint : "0.12.1",
ktlint : "0.14.0",
ktlintGradle : "2.3.0",
detekt : "1.0.0.RC6",
jacoco : "0.7.9",

View File

@ -14,7 +14,7 @@ abstract class SubsonicAPIClientTest {
@Before
fun setUp() {
client = SubsonicAPIClient(mockWebServerRule.mockWebServer.url("/").toString(), USERNAME, PASSWORD,
CLIENT_VERSION, CLIENT_ID)
client = SubsonicAPIClient(mockWebServerRule.mockWebServer.url("/").toString(),
USERNAME, PASSWORD, CLIENT_VERSION, CLIENT_ID)
}
}

View File

@ -50,16 +50,18 @@ class SubsonicApiGetAlbumTest : SubsonicAPIClientTest() {
year `should equal to` 2008
genre `should equal to` "Hard Rock"
songList.size `should equal to` 15
songList[0] `should equal` MusicDirectoryChild(id = "6491", parent = "6475", isDir = false,
title = "Rock 'n' Roll Train", album = "Black Ice", artist = "AC/DC",
track = 1, year = 2008, genre = "Hard Rock", coverArt = "6475", size = 7205451,
contentType = "audio/mpeg", suffix = "mp3", duration = 261, bitRate = 219,
path = "AC_DC/Black Ice/01 Rock 'n' Roll Train.mp3", isVideo = false,
playCount = 0, discNumber = 1, created = parseDate("2016-10-23T15:31:20.000Z"),
songList[0] `should equal` MusicDirectoryChild(id = "6491", parent = "6475",
isDir = false, title = "Rock 'n' Roll Train", album = "Black Ice",
artist = "AC/DC", track = 1, year = 2008, genre = "Hard Rock",
coverArt = "6475", size = 7205451, contentType = "audio/mpeg", suffix = "mp3",
duration = 261, bitRate = 219,
path = "AC_DC/Black Ice/01 Rock 'n' Roll Train.mp3",
isVideo = false, playCount = 0, discNumber = 1,
created = parseDate("2016-10-23T15:31:20.000Z"),
albumId = "618", artistId = "362", type = "music")
songList[5] `should equal` MusicDirectoryChild(id = "6492", parent = "6475", isDir = false,
title = "Smash 'n' Grab", album = "Black Ice", artist = "AC/DC", track = 6,
year = 2008, genre = "Hard Rock", coverArt = "6475", size = 6697204,
songList[5] `should equal` MusicDirectoryChild(id = "6492", parent = "6475",
isDir = false, title = "Smash 'n' Grab", album = "Black Ice", artist = "AC/DC",
track = 6, year = 2008, genre = "Hard Rock", coverArt = "6475", size = 6697204,
contentType = "audio/mpeg", suffix = "mp3", duration = 246, bitRate = 216,
path = "AC_DC/Black Ice/06 Smash 'n' Grab.mp3", isVideo = false, playCount = 0,
discNumber = 1, created = parseDate("2016-10-23T15:31:20.000Z"),

View File

@ -37,11 +37,14 @@ class SubsonicApiGetArtistsTest : SubsonicAPIClientTest() {
indexList `should equal` listOf(
Index(name = "A", artists = listOf(
Artist(id = "362", name = "AC/DC", coverArt = "ar-362", albumCount = 2),
Artist(id = "254", name = "Acceptance", coverArt = "ar-254", albumCount = 1)
Artist(id = "254", name = "Acceptance", coverArt = "ar-254",
albumCount = 1)
)),
Index(name = "T", artists = listOf(
Artist(id = "516", name = "Tangerine Dream", coverArt = "ar-516", albumCount = 1),
Artist(id = "242", name = "Taproot", coverArt = "ar-242", albumCount = 2)
Artist(id = "516", name = "Tangerine Dream", coverArt = "ar-516",
albumCount = 1),
Artist(id = "242", name = "Taproot", coverArt = "ar-242",
albumCount = 2)
))
)
}

View File

@ -50,19 +50,21 @@ class SubsonicApiGetMusicDirectoryTest : SubsonicAPIClientTest() {
starred `should equal` null
playCount `should equal to` 1
childList.size `should be` 2
childList[0] `should equal` MusicDirectoryChild(id = "4844", parent = "4836", isDir = false,
title = "Crash", album = "12 Stones", artist = "12 Stones", track = 1, year = 2002,
genre = "Alternative Rock", coverArt = "4836", size = 5348318L,
contentType = "audio/mpeg", suffix = "mp3", duration = 222, bitRate = 192,
path = "12 Stones/12 Stones/01 Crash.mp3", isVideo = false, playCount = 0,
discNumber = 1, created = parseDate("2016-10-23T15:19:10.000Z"),
childList[0] `should equal` MusicDirectoryChild(id = "4844", parent = "4836",
isDir = false, title = "Crash", album = "12 Stones", artist = "12 Stones",
track = 1, year = 2002, genre = "Alternative Rock", coverArt = "4836",
size = 5348318L, contentType = "audio/mpeg", suffix = "mp3", duration = 222,
bitRate = 192, path = "12 Stones/12 Stones/01 Crash.mp3", isVideo = false,
playCount = 0, discNumber = 1,
created = parseDate("2016-10-23T15:19:10.000Z"),
albumId = "454", artistId = "288", type = "music")
childList[1] `should equal` MusicDirectoryChild(id = "4845", parent = "4836", isDir = false,
title = "Broken", album = "12 Stones", artist = "12 Stones", track = 2, year = 2002,
genre = "Alternative Rock", coverArt = "4836", size = 4309043L,
contentType = "audio/mpeg", suffix = "mp3", duration = 179, bitRate = 192,
path = "12 Stones/12 Stones/02 Broken.mp3", isVideo = false, playCount = 0,
discNumber = 1, created = parseDate("2016-10-23T15:19:09.000Z"),
childList[1] `should equal` MusicDirectoryChild(id = "4845", parent = "4836",
isDir = false, title = "Broken", album = "12 Stones", artist = "12 Stones",
track = 2, year = 2002, genre = "Alternative Rock", coverArt = "4836",
size = 4309043L, contentType = "audio/mpeg", suffix = "mp3", duration = 179,
bitRate = 192, path = "12 Stones/12 Stones/02 Broken.mp3", isVideo = false,
playCount = 0, discNumber = 1,
created = parseDate("2016-10-23T15:19:09.000Z"),
albumId = "454", artistId = "288", type = "music")
}
}

View File

@ -33,13 +33,16 @@ class SubsonicApiGetPodcastsTest : SubsonicAPIClientTest() {
id `should equal to` "2"
url `should equal to` "http://feeds.codenewbie.org/cnpodcast.xml"
title `should equal to` "CodeNewbie"
description `should equal to` "Stories and interviews from people on their coding journey."
description `should equal to` "Stories and interviews from people on their coding " +
"journey."
coverArt `should equal to` "pod-2"
originalImageUrl `should equal to` "http://codenewbie.blubrry.com/wp-content/uploads/powerpress/220808.jpg"
originalImageUrl `should equal to` "http://codenewbie.blubrry.com/wp-content/uploads/" +
"powerpress/220808.jpg"
status `should equal to` "completed"
errorMessage `should equal to` ""
episodeList.size `should equal to` 10
episodeList[0] `should equal` MusicDirectoryChild(id = "148", parent = "9959", isDir = false,
episodeList[0] `should equal` MusicDirectoryChild(id = "148", parent = "9959",
isDir = false,
title = "S1:EP3 How to teach yourself computer science (Vaidehi Joshi)",
album = "CodeNewbie", artist = "podcasts", coverArt = "9959",
size = 38274221, contentType = "audio/mpeg", suffix = "mp3",
@ -56,7 +59,8 @@ class SubsonicApiGetPodcastsTest : SubsonicAPIClientTest() {
"CodeNewbie basecs 100 Days of Code Conway's Game of Life Hexes and " +
"Other Magical Numbers (Vaidehi's blog post) Bits, Bytes, Building " +
"With Binary (Vaidehi's blog post) Rust",
status = "completed", publishDate = parseDate("2017-08-29T00:01:01.000Z"))
status = "completed",
publishDate = parseDate("2017-08-29T00:01:01.000Z"))
}
}

View File

@ -39,8 +39,10 @@ class SubsonicApiGetSongsByGenreTest : SubsonicAPIClientTest() {
artist = "DJ Polyakov PPK Feat Kate Cameron", year = 2009, genre = "Trance",
size = 26805932, contentType = "audio/mpeg", suffix = "mp3", duration = 670,
bitRate = 320,
path = "DJ Polyakov PPK Feat Kate Cameron/668/00 My Heart (Vadim Zhukov Remix).mp3",
isVideo = false, playCount = 2, created = parseDate("2016-10-23T21:58:29.000Z"),
path = "DJ Polyakov PPK Feat Kate Cameron/668/00 My Heart (Vadim Zhukov " +
"Remix).mp3",
isVideo = false, playCount = 2,
created = parseDate("2016-10-23T21:58:29.000Z"),
albumId = "5", artistId = "4", type = "music")
}
}

View File

@ -27,11 +27,13 @@ class SubsonicApiGetVideosListTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body().videosList) {
size `should equal to` 1
this[0] `should equal` MusicDirectoryChild(id = "10402", parent = "10401", isDir = false,
title = "MVI_0512", album = "Incoming", size = 21889646,
contentType = "video/avi", suffix = "avi", transcodedContentType = "video/x-flv",
transcodedSuffix = "flv", path = "Incoming/MVI_0512.avi", isVideo = true,
playCount = 0, created = parseDate("2017-11-19T12:34:33.000Z"), type = "video")
this[0] `should equal` MusicDirectoryChild(id = "10402", parent = "10401",
isDir = false, title = "MVI_0512", album = "Incoming", size = 21889646,
contentType = "video/avi", suffix = "avi",
transcodedContentType = "video/x-flv", transcodedSuffix = "flv",
path = "Incoming/MVI_0512.avi", isVideo = true,
playCount = 0, created = parseDate("2017-11-19T12:34:33.000Z"),
type = "video")
}
}
}

View File

@ -56,8 +56,8 @@ class SubsonicApiJukeboxControlTest : SubsonicAPIClientTest() {
artist = "The Pretty Reckless", track = 2, year = 2014, genre = "Hard Rock",
coverArt = "4186", size = 11089627, contentType = "audio/mpeg",
suffix = "mp3", duration = 277, bitRate = 320,
path = "The Pretty Reckless/Going to Hell/02 Going to Hell.mp3", isVideo = false,
playCount = 0, discNumber = 1,
path = "The Pretty Reckless/Going to Hell/02 Going to Hell.mp3",
isVideo = false, playCount = 0, discNumber = 1,
created = parseDate("2016-10-23T21:30:41.000Z"), albumId = "388",
artistId = "238", type = "music")
}

View File

@ -10,8 +10,8 @@ import org.junit.Test
class SubsonicApiPasswordTest : SubsonicAPIClientTest() {
@Test
fun `Should pass PasswordMD5Interceptor in query params for api version 1 13 0`() {
val clientV12 = SubsonicAPIClient(mockWebServerRule.mockWebServer.url("/").toString(), USERNAME,
PASSWORD, SubsonicAPIVersions.V1_14_0, CLIENT_ID)
val clientV12 = SubsonicAPIClient(mockWebServerRule.mockWebServer.url("/").toString(),
USERNAME, PASSWORD, SubsonicAPIVersions.V1_14_0, CLIENT_ID)
mockWebServerRule.enqueueResponse("ping_ok.json")
clientV12.api.ping().execute()
@ -25,8 +25,8 @@ class SubsonicApiPasswordTest : SubsonicAPIClientTest() {
@Test
fun `Should pass PasswordHexInterceptor in query params for api version 1 12 0`() {
val clientV11 = SubsonicAPIClient(mockWebServerRule.mockWebServer.url("/").toString(), USERNAME,
PASSWORD, SubsonicAPIVersions.V1_12_0, CLIENT_ID)
val clientV11 = SubsonicAPIClient(mockWebServerRule.mockWebServer.url("/").toString(),
USERNAME, PASSWORD, SubsonicAPIVersions.V1_12_0, CLIENT_ID)
mockWebServerRule.enqueueResponse("ping_ok.json")
clientV11.api.ping().execute()

View File

@ -39,7 +39,8 @@ class SubsonicApiSearchTest : SubsonicAPIClientTest() {
track = 17, year = 2005, genre = "Rap", coverArt = "5766",
size = 5607024, contentType = "audio/mpeg", suffix = "mp3", duration = 233,
bitRate = 192,
path = "Compilations/Need for Speed Most Wanted/17 You'll Be Under My Wheels.mp3",
path = "Compilations/Need for Speed Most Wanted/17 You'll Be Under My Wheels" +
".mp3",
isVideo = false, playCount = 0, discNumber = 1,
created = parseDate("2016-10-23T20:09:02.000Z"), albumId = "568",
artistId = "505", type = "music")

View File

@ -32,20 +32,23 @@ class SubsonicApiSearchThreeTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body().searchResult) {
artistList.size `should equal to` 1
artistList[0] `should equal` Artist(id = "505", name = "The Prodigy", coverArt = "ar-505",
albumCount = 5)
artistList[0] `should equal` Artist(id = "505", name = "The Prodigy",
coverArt = "ar-505", albumCount = 5)
albumList.size `should equal to` 1
albumList[0] `should equal` Album(id = "855", name = "Always Outnumbered, Never Outgunned",
albumList[0] `should equal` Album(id = "855",
name = "Always Outnumbered, Never Outgunned",
artist = "The Prodigy", artistId = "505", coverArt = "al-855", songCount = 12,
duration = 3313, created = parseDate("2016-10-23T20:57:27.000Z"),
year = 2004, genre = "Electronic")
songList.size `should equal to` 1
songList[0] `should equal` MusicDirectoryChild(id = "5831", parent = "5766", isDir = false,
songList[0] `should equal` MusicDirectoryChild(id = "5831", parent = "5766",
isDir = false,
title = "You'll Be Under My Wheels", album = "Need for Speed Most Wanted",
artist = "The Prodigy", track = 17, year = 2005, genre = "Rap",
coverArt = "5766", size = 5607024, contentType = "audio/mpeg",
suffix = "mp3", duration = 233, bitRate = 192,
path = "Compilations/Need for Speed Most Wanted/17 You'll Be Under My Wheels.mp3",
path = "Compilations/Need for Speed Most Wanted/17 You'll Be Under My Wheels" +
".mp3",
isVideo = false, playCount = 0, discNumber = 1,
created = parseDate("2016-10-23T20:09:02.000Z"), albumId = "568",
artistId = "505", type = "music")
@ -56,9 +59,10 @@ class SubsonicApiSearchThreeTest : SubsonicAPIClientTest() {
fun `Should pass query as request param`() {
val query = "some-wip-query"
mockWebServerRule.assertRequestParam(responseResourceName = "search3_ok.json", apiRequest = {
mockWebServerRule.assertRequestParam(responseResourceName = "search3_ok.json",
expectedParam = "query=$query") {
client.api.search3(query = query).execute()
}, expectedParam = "query=$query")
}
}
@Test

View File

@ -33,18 +33,20 @@ class SubsonicApiSearchTwoTest : SubsonicAPIClientTest() {
artistList.size `should equal to` 1
artistList[0] `should equal` Artist(id = "522", name = "The Prodigy")
albumList.size `should equal to` 1
albumList[0] `should equal` MusicDirectoryChild(id = "8867", parent = "522", isDir = true,
title = "Always Outnumbered, Never Outgunned",
albumList[0] `should equal` MusicDirectoryChild(id = "8867", parent = "522",
isDir = true, title = "Always Outnumbered, Never Outgunned",
album = "Always Outnumbered, Never Outgunned", artist = "The Prodigy",
year = 2004, genre = "Electronic", coverArt = "8867", playCount = 0,
created = parseDate("2016-10-23T20:57:27.000Z"))
songList.size `should equal to` 1
songList[0] `should equal` MusicDirectoryChild(id = "5831", parent = "5766", isDir = false,
songList[0] `should equal` MusicDirectoryChild(id = "5831", parent = "5766",
isDir = false,
title = "You'll Be Under My Wheels", album = "Need for Speed Most Wanted",
artist = "The Prodigy", track = 17, year = 2005, genre = "Rap",
coverArt = "5766", size = 5607024, contentType = "audio/mpeg",
suffix = "mp3", duration = 233, bitRate = 192,
path = "Compilations/Need for Speed Most Wanted/17 You'll Be Under My Wheels.mp3",
path = "Compilations/Need for Speed Most Wanted/17 You'll Be Under My Wheels" +
".mp3",
isVideo = false, playCount = 0, discNumber = 1,
created = parseDate("2016-10-23T20:09:02.000Z"),
albumId = "568", artistId = "505", type = "music")

View File

@ -40,7 +40,8 @@ class VersionInterceptorTest : BaseInterceptorTest() {
client.newCall(createRequest {}).execute()
(interceptor as VersionInterceptor).protocolVersion `should equal` SubsonicAPIVersions.V1_13_0
(interceptor as VersionInterceptor)
.protocolVersion `should equal` SubsonicAPIVersions.V1_13_0
}
@Test

View File

@ -271,7 +271,9 @@ internal class ApiVersionCheckWrapper(
return api.getBookmarks()
}
override fun createBookmark(id: String, position: Long, comment: String?): Call<SubsonicResponse> {
override fun createBookmark(id: String,
position: Long,
comment: String?): Call<SubsonicResponse> {
checkVersion(V1_9_0)
return api.createBookmark(id, position, comment)
}

View File

@ -127,7 +127,8 @@ interface SubsonicAPIDefinition {
@Query("comment") comment: String? = null,
@Query("public") public: Boolean? = null,
@Query("songIdToAdd") songIdsToAdd: List<String>? = null,
@Query("songIndexToRemove") songIndexesToRemove: List<Int>? = null): Call<SubsonicResponse>
@Query("songIndexToRemove") songIndexesToRemove: List<Int>? = null):
Call<SubsonicResponse>
@GET("getPodcasts.view")
fun getPodcasts(@Query("includeEpisodes") includeEpisodes: Boolean? = null,
@ -143,35 +144,39 @@ interface SubsonicAPIDefinition {
@Query("submission") submission: Boolean? = null): Call<SubsonicResponse>
@GET("getAlbumList.view")
fun getAlbumList(@Query("type") type: AlbumListType,
@Query("size") size: Int? = null,
@Query("offset") offset: Int? = null,
@Query("fromYear") fromYear: Int? = null,
@Query("toYear") toYear: Int? = null,
@Query("genre") genre: String? = null,
@Query("musicFolderId") musicFolderId: String? = null): Call<GetAlbumListResponse>
fun getAlbumList(
@Query("type") type: AlbumListType,
@Query("size") size: Int? = null,
@Query("offset") offset: Int? = null,
@Query("fromYear") fromYear: Int? = null,
@Query("toYear") toYear: Int? = null,
@Query("genre") genre: String? = null,
@Query("musicFolderId") musicFolderId: String? = null): Call<GetAlbumListResponse>
@GET("getAlbumList2.view")
fun getAlbumList2(@Query("type") type: AlbumListType,
@Query("size") size: Int? = null,
@Query("offset") offset: Int? = null,
@Query("fromYear") fromYear: Int? = null,
@Query("toYear") toYear: Int? = null,
@Query("genre") genre: String? = null,
@Query("musicFolderId") musicFolderId: String? = null): Call<GetAlbumList2Response>
fun getAlbumList2(
@Query("type") type: AlbumListType,
@Query("size") size: Int? = null,
@Query("offset") offset: Int? = null,
@Query("fromYear") fromYear: Int? = null,
@Query("toYear") toYear: Int? = null,
@Query("genre") genre: String? = null,
@Query("musicFolderId") musicFolderId: String? = null): Call<GetAlbumList2Response>
@GET("getRandomSongs.view")
fun getRandomSongs(@Query("size") size: Int? = null,
@Query("genre") genre: String? = null,
@Query("fromYear") fromYear: Int? = null,
@Query("toYear") toYear: Int? = null,
@Query("musicFolderId") musicFolderId: String? = null): Call<GetRandomSongsResponse>
fun getRandomSongs(
@Query("size") size: Int? = null,
@Query("genre") genre: String? = null,
@Query("fromYear") fromYear: Int? = null,
@Query("toYear") toYear: Int? = null,
@Query("musicFolderId") musicFolderId: String? = null): Call<GetRandomSongsResponse>
@GET("getStarred.view")
fun getStarred(@Query("musicFolderId") musicFolderId: String? = null): Call<GetStarredResponse>
@GET("getStarred2.view")
fun getStarred2(@Query("musicFolderId") musicFolderId: String? = null): Call<GetStarredTwoResponse>
fun getStarred2(
@Query("musicFolderId") musicFolderId: String? = null): Call<GetStarredTwoResponse>
@Streaming
@GET("getCoverArt.view")

View File

@ -55,7 +55,8 @@ enum class SubsonicAPIVersions(val subsonicVersions: String, val restApiVersion:
}
class SubsonicAPIVersionsDeserializer : JsonDeserializer<SubsonicAPIVersions>() {
override fun deserialize(p: JsonParser, ctxt: DeserializationContext?): SubsonicAPIVersions {
override fun deserialize(p: JsonParser,
ctxt: DeserializationContext?): SubsonicAPIVersions {
if (p.currentName != "version") {
throw JsonParseException(p, "Not valid token for API version!")
}

View File

@ -36,6 +36,6 @@ internal class RangeHeaderInterceptor : Interceptor {
// to avoid the thrashing effect seen when offset is combined with transcoding/downsampling
// on the server. In that case, the server uses a long time before sending any data,
// causing the client to time out.
private fun getReadTimeout(offset: Int)
= (SOCKET_READ_TIMEOUT_DOWNLOAD + offset * TIMEOUT_MILLIS_PER_OFFSET_BYTE).toInt()
private fun getReadTimeout(offset: Int) =
(SOCKET_READ_TIMEOUT_DOWNLOAD + offset * TIMEOUT_MILLIS_PER_OFFSET_BYTE).toInt()
}

View File

@ -2,6 +2,7 @@ package org.moire.ultrasonic.api.subsonic.models
import com.fasterxml.jackson.annotation.JsonProperty
data class SearchResult(val offset: Int = 0,
val totalHits: Int = 0,
@JsonProperty("match") val matchList: List<MusicDirectoryChild> = emptyList())
data class SearchResult(
val offset: Int = 0,
val totalHits: Int = 0,
@JsonProperty("match") val matchList: List<MusicDirectoryChild> = emptyList())

View File

@ -16,4 +16,5 @@ class GetPlaylistsResponse(status: Status,
get() = playlistsWrapper.playlistList
}
private class PlaylistsWrapper(@JsonProperty("playlist") val playlistList: List<Playlist> = emptyList())
private class PlaylistsWrapper(
@JsonProperty("playlist") val playlistList: List<Playlist> = emptyList())

View File

@ -5,8 +5,9 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
import org.moire.ultrasonic.api.subsonic.SubsonicError
import org.moire.ultrasonic.api.subsonic.models.SearchTwoResult
class SearchTwoResponse(status: Status,
version: SubsonicAPIVersions,
error: SubsonicError?,
@JsonProperty("searchResult2") val searchResult: SearchTwoResult = SearchTwoResult())
class SearchTwoResponse(
status: Status,
version: SubsonicAPIVersions,
error: SubsonicError?,
@JsonProperty("searchResult2") val searchResult: SearchTwoResult = SearchTwoResult())
: SubsonicResponse(status, version, error)

View File

@ -8,5 +8,5 @@ import org.moire.ultrasonic.api.subsonic.models.MusicFolder as APIMusicFolder
fun APIMusicFolder.toDomainEntity(): MusicFolder = MusicFolder(this.id, this.name)
fun List<APIMusicFolder>.toDomainEntityList(): List<MusicFolder>
= this.map { it.toDomainEntity() }
fun List<APIMusicFolder>.toDomainEntityList(): List<MusicFolder> =
this.map { it.toDomainEntity() }

View File

@ -15,9 +15,9 @@ import java.util.Calendar
class APIAlbumConverterTest {
@Test
fun `Should convert Album to domain entity`() {
val entity = Album(id = "387", name = "some-name", coverArt = "asdas", artist = "some-artist",
artistId = "390", songCount = 12, duration = 841, created = Calendar.getInstance(),
year = 2017, genre = "some-genre")
val entity = Album(id = "387", name = "some-name", coverArt = "asdas",
artist = "some-artist", artistId = "390", songCount = 12, duration = 841,
created = Calendar.getInstance(), year = 2017, genre = "some-genre")
val convertedEntity = entity.toDomainEntity()

View File

@ -27,7 +27,8 @@ class APIArtistConverterTest {
@Test
fun `Should convert Artist entity to domain MusicDirectory entity`() {
val entity = Artist(id = "101", name = "artist-name", coverArt = "some-art", albumCount = 10,
val entity = Artist(id = "101", name = "artist-name", coverArt = "some-art",
albumCount = 10,
albumsList = listOf(Album(id = "562", name = "some-name", coverArt = "zzz",
artist = "artist-name", artistId = "256", songCount = 10, duration = 345,
created = Calendar.getInstance(), year = 2011, genre = "Math Rock")))

View File

@ -16,8 +16,8 @@ class APIIndexesConverterTest {
@Test
fun `Should convert Indexes entity`() {
val artistsA = listOf(
Artist(id ="4", name = "AC/DC"),
Artist(id ="45", name = "ABBA"))
Artist(id = "4", name = "AC/DC"),
Artist(id = "45", name = "ABBA"))
val artistsT = listOf(
Artist(id = "10", name = "Taproot"),
Artist(id = "12", name = "Teebee"))

View File

@ -37,7 +37,8 @@ class APIMusicDirectoryConverterTest {
transcodedContentType = "some-transcoded-content-type",
transcodedSuffix = "some-transcoded-suffix", duration = 11, bitRate = 256,
path = "some-path", isDir = true, isVideo = true, playCount = 323, discNumber = 2,
created = Calendar.getInstance(), type = "some-type", starred = Calendar.getInstance())
created = Calendar.getInstance(), type = "some-type",
starred = Calendar.getInstance())
val convertedEntity = entity.toDomainEntity()