Change artist id type to String.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2017-12-16 19:50:57 +01:00
parent 66d7973c5a
commit a694f895e9
12 changed files with 25 additions and 25 deletions

View File

@ -39,7 +39,7 @@ class SubsonicApiGetArtistTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body().artist) {
id `should equal to` 362L
id `should equal to` "362"
name `should equal to` "AC/DC"
coverArt `should equal to` "ar-362"
albumCount `should equal to` 2

View File

@ -36,12 +36,12 @@ class SubsonicApiGetArtistsTest : SubsonicAPIClientTest() {
indexList.size `should equal to` 2
indexList `should equal` listOf(
Index(name = "A", artists = listOf(
Artist(id = 362L, name = "AC/DC", coverArt = "ar-362", albumCount = 2),
Artist(id = 254L, name = "Acceptance", coverArt = "ar-254", albumCount = 1)
Artist(id = "362", name = "AC/DC", coverArt = "ar-362", albumCount = 2),
Artist(id = "254", name = "Acceptance", coverArt = "ar-254", albumCount = 1)
)),
Index(name = "T", artists = listOf(
Artist(id = 516L, name = "Tangerine Dream", coverArt = "ar-516", albumCount = 1),
Artist(id = 242L, 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

@ -23,18 +23,18 @@ class SubsonicApiGetIndexesTest : SubsonicAPIClientTest() {
lastModified `should equal` 1491069027523
ignoredArticles `should equal` "The El La Los Las Le Les"
shortcutList `should equal` listOf(
Artist(id = 889L, name = "podcasts"),
Artist(id = 890L, name = "audiobooks")
Artist(id = "889", name = "podcasts"),
Artist(id = "890", name = "audiobooks")
)
indexList `should equal` mutableListOf(
Index("A", listOf(
Artist(id = 50L, name = "Ace Of Base",
Artist(id = "50", name = "Ace Of Base",
starred = parseDate("2017-04-02T20:16:29.815Z")),
Artist(id = 379L, name = "A Perfect Circle")
Artist(id = "379", name = "A Perfect Circle")
)),
Index("H", listOf(
Artist(id = 299, name = "Haddaway"),
Artist(id = 297, name = "Halestorm")
Artist(id = "299", name = "Haddaway"),
Artist(id = "297", name = "Halestorm")
))
)
}

View File

@ -30,7 +30,7 @@ class SubsonicApiGetStarred2Test : SubsonicAPIClientTest() {
with(response.body().starred2) {
albumList `should equal` emptyList()
artistList.size `should equal to` 1
artistList[0] `should equal` Artist(id = 364, name = "Parov Stelar",
artistList[0] `should equal` Artist(id = "364", name = "Parov Stelar",
starred = parseDate("2017-08-12T18:32:58.768Z"))
songList `should equal` emptyList()
}

View File

@ -29,7 +29,7 @@ class SubsonicApiGetStarredTest : SubsonicAPIClientTest() {
with(response.body().starred) {
albumList `should equal` emptyList()
artistList.size `should equal to` 1
artistList[0] `should equal` Artist(id = 364, name = "Parov Stelar",
artistList[0] `should equal` Artist(id = "364", name = "Parov Stelar",
starred = parseDate("2017-08-12T18:32:58.768Z"))
songList `should equal` emptyList()
}

View File

@ -32,7 +32,7 @@ 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",
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",

View File

@ -31,7 +31,7 @@ class SubsonicApiSearchTwoTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body().searchResult) {
artistList.size `should equal to` 1
artistList[0] `should equal` Artist(id = 522, name = "The Prodigy")
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",

View File

@ -3,7 +3,7 @@ package org.moire.ultrasonic.api.subsonic.models
import com.fasterxml.jackson.annotation.JsonProperty
import java.util.Calendar
data class Artist(val id: Long = -1,
data class Artist(val id: String = "",
val name: String = "",
val coverArt: String = "",
val albumCount: Int = 0,

View File

@ -8,7 +8,7 @@ import org.moire.ultrasonic.domain.MusicDirectory
import org.moire.ultrasonic.api.subsonic.models.Artist as APIArtist
fun APIArtist.toDomainEntity(): Artist = Artist().apply {
id = this@toDomainEntity.id.toString()
id = this@toDomainEntity.id
name = this@toDomainEntity.name
}

View File

@ -15,7 +15,7 @@ import java.util.Calendar
class APIArtistConverterTest {
@Test
fun `Should convert artist entity`() {
val entity = Artist(id = 10, name = "artist-name", starred = Calendar.getInstance())
val entity = Artist(id = "10", name = "artist-name", starred = Calendar.getInstance())
val convertedEntity = entity.toDomainEntity()
@ -27,7 +27,7 @@ class APIArtistConverterTest {
@Test
fun `Should convert Artist entity to domain MusicDirectory entity`() {
val entity = Artist(id = 101L, 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 = 562L, name = "some-name", coverArt = "zzz",
artist = "artist-name", artistId = 256L, songCount = 10, duration = 345,
created = Calendar.getInstance(), year = 2011, genre = "Math Rock")))

View File

@ -16,11 +16,11 @@ 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"))
Artist(id = "10", name = "Taproot"),
Artist(id = "12", name = "Teebee"))
val entity = Indexes(lastModified = 154, ignoredArticles = "Le Tre Ze", indexList = listOf(
Index(name = "A", artists = artistsA),
Index(name = "T", artists = artistsT)

View File

@ -38,7 +38,7 @@ class APISearchConverterTest {
@Test
fun `Should convert SearchTwoResult to domain entity`() {
val entity = SearchTwoResult(listOf(
Artist(id = 82, name = "great-artist-name")
Artist(id = "82", name = "great-artist-name")
), listOf(
MusicDirectoryChild(id = 762, artist = "bzz")
), listOf(
@ -60,7 +60,7 @@ class APISearchConverterTest {
@Test
fun `Should convert SearchThreeResult to domain entity`() {
val entity = SearchThreeResult(
artistList = listOf(Artist(id = 612, name = "artist1")),
artistList = listOf(Artist(id = "612", name = "artist1")),
albumList = listOf(Album(id = 221, name = "album1")),
songList = listOf(MusicDirectoryChild(id = 7123, title = "song1"))
)