mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-16 19:50:35 +01:00
Change MusicDirectoryChild ids type to String.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
ad20064d79
commit
5bf5af2842
@ -39,13 +39,13 @@ class SubsonicApiCreateShareTest : SubsonicAPIClientTest() {
|
||||
description `should equal to` "Awesome link!"
|
||||
visitCount `should equal to` 0
|
||||
items.size `should equal to` 1
|
||||
items[0] `should equal` MusicDirectoryChild(id = 4212, parent = 4186, isDir = false,
|
||||
items[0] `should equal` MusicDirectoryChild(id = "4212", parent = "4186", isDir = false,
|
||||
title = "Heaven Knows", album = "Going to Hell", artist = "The Pretty Reckless",
|
||||
track = 3, year = 2014, genre = "Hard Rock", coverArt = "4186", size = 9025090,
|
||||
contentType = "audio/mpeg", suffix = "mp3", duration = 225, bitRate = 320,
|
||||
path = "The Pretty Reckless/Going to Hell/03 Heaven Knows.mp3", isVideo = false,
|
||||
playCount = 2, discNumber = 1, created = parseDate("2016-10-23T21:30:40.000Z"),
|
||||
albumId = 388, artistId = 238, type = "music")
|
||||
albumId = "388", artistId = "238", type = "music")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ class SubsonicApiGetAlbumListRequestTest : SubsonicAPIClientTest() {
|
||||
assertResponseSuccessful(response)
|
||||
with(response.body().albumList) {
|
||||
size `should equal to` 2
|
||||
this[1] `should equal` MusicDirectoryChild(id = 9997, parent = 9996, isDir = true,
|
||||
this[1] `should equal` MusicDirectoryChild(id = "9997", parent = "9996", isDir = true,
|
||||
title = "Endless Forms Most Beautiful", album = "Endless Forms Most Beautiful",
|
||||
artist = "Nightwish", year = 2015, genre = "Symphonic Metal",
|
||||
coverArt = "9997", playCount = 11,
|
||||
|
@ -50,20 +50,20 @@ 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 = 6491L, parent = 6475L, isDir = false,
|
||||
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 = 618L, artistId = 362L, type = "music")
|
||||
songList[5] `should equal` MusicDirectoryChild(id = 6492L, parent = 6475L, isDir = false,
|
||||
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,
|
||||
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"),
|
||||
albumId = 618L, artistId = 362L, type = "music")
|
||||
albumId = "618", artistId = "362", type = "music")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class SubsonicApiGetBookmarksTest : SubsonicAPIClientTest() {
|
||||
comment `should equal to` "Look at this"
|
||||
created `should equal` parseDate("2017-11-18T15:22:22.144Z")
|
||||
changed `should equal` parseDate("2017-11-18T15:22:22.144Z")
|
||||
entry `should equal` MusicDirectoryChild(id = 10349, parent = 10342,
|
||||
entry `should equal` MusicDirectoryChild(id = "10349", parent = "10342",
|
||||
isDir = false, title = "Amerika", album = "Home of the Strange",
|
||||
artist = "Young the Giant", track = 1, year = 2016, genre = "Indie Rock",
|
||||
coverArt = "10342", size = 9628673, contentType = "audio/mpeg",
|
||||
@ -40,7 +40,7 @@ class SubsonicApiGetBookmarksTest : SubsonicAPIClientTest() {
|
||||
path = "Young the Giant/Home of the Strange/01 Amerika.mp3",
|
||||
isVideo = false, playCount = 2, discNumber = 1,
|
||||
created = parseDate("2017-11-01T17:46:52.000Z"),
|
||||
albumId = 984, artistId = 571, type = "music")
|
||||
albumId = "984", artistId = "571", type = "music")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,20 +50,20 @@ class SubsonicApiGetMusicDirectoryTest : SubsonicAPIClientTest() {
|
||||
starred `should equal` null
|
||||
playCount `should equal to` 1
|
||||
childList.size `should be` 2
|
||||
childList[0] `should equal` MusicDirectoryChild(id = 4844L, parent = 4836L, isDir = false,
|
||||
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 = 454L, artistId = 288L, type = "music")
|
||||
childList[1] `should equal` MusicDirectoryChild(id = 4845L, parent = 4836L, isDir = false,
|
||||
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"),
|
||||
albumId = 454L, artistId = 288L, type = "music")
|
||||
albumId = "454", artistId = "288", type = "music")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class SubsonicApiGetPlaylistTest : SubsonicAPIClientTest() {
|
||||
changed `should equal` parseDate("2017-08-27T11:17:26.218Z")
|
||||
coverArt `should equal to` "pl-0"
|
||||
entriesList.size `should equal to` 2
|
||||
entriesList[1] `should equal` MusicDirectoryChild(id = 4215, parent = 4186,
|
||||
entriesList[1] `should equal` MusicDirectoryChild(id = "4215", parent = "4186",
|
||||
isDir = false, title = "Going to Hell", album = "Going to Hell",
|
||||
artist = "The Pretty Reckless", track = 2, year = 2014,
|
||||
genre = "Hard Rock", coverArt = "4186", size = 11089627,
|
||||
@ -47,7 +47,7 @@ class SubsonicApiGetPlaylistTest : SubsonicAPIClientTest() {
|
||||
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")
|
||||
albumId = "388", artistId = "238", type = "music")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,13 +39,13 @@ class SubsonicApiGetPodcastsTest : SubsonicAPIClientTest() {
|
||||
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",
|
||||
duration = 2397, bitRate = 128, isVideo = false, playCount = 0,
|
||||
created = parseDate("2017-08-30T09:33:39.000Z"), type = "podcast",
|
||||
streamId = 9982, channelId = 2,
|
||||
streamId = "9982", channelId = "2",
|
||||
description = "Vaidehi decided to take on a year-long challenge. " +
|
||||
"She'd pick a computer science topic every week, do tons of research " +
|
||||
"and write a technical blog post explaining it in simple terms and " +
|
||||
|
@ -27,14 +27,14 @@ class SubsonicApiGetRandomSongsTest : SubsonicAPIClientTest() {
|
||||
assertResponseSuccessful(response)
|
||||
with(response.body().songsList) {
|
||||
size `should equal to` 3
|
||||
this[1] `should equal` MusicDirectoryChild(id = 3061, parent = 3050, isDir = false,
|
||||
this[1] `should equal` MusicDirectoryChild(id = "3061", parent = "3050", isDir = false,
|
||||
title = "Sure as Hell", album = "Who Are You Now?", artist = "This Providence",
|
||||
track = 1, year = 2009, genre = "Indie Rock", coverArt = "3050",
|
||||
size = 1969692, contentType = "audio/mpeg", suffix = "mp3", duration = 110,
|
||||
bitRate = 142, path = "This Providence/Who Are You Now_/01 Sure as Hell.mp3",
|
||||
isVideo = false, playCount = 0, discNumber = 1,
|
||||
created = parseDate("2016-10-23T21:32:46.000Z"), albumId = 272,
|
||||
artistId = 152, type = "music")
|
||||
created = parseDate("2016-10-23T21:32:46.000Z"), albumId = "272",
|
||||
artistId = "152", type = "music")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,13 +38,13 @@ class SubsonicApiGetSharesTest : SubsonicAPIClientTest() {
|
||||
visitCount `should equal to` 0
|
||||
description `should equal to` "Awesome link!"
|
||||
items.size `should equal to` 1
|
||||
items[0] `should equal` MusicDirectoryChild(id = 4212, parent = 4186, isDir = false,
|
||||
items[0] `should equal` MusicDirectoryChild(id = "4212", parent = "4186", isDir = false,
|
||||
title = "Heaven Knows", album = "Going to Hell", artist = "The Pretty Reckless",
|
||||
track = 3, year = 2014, genre = "Hard Rock", coverArt = "4186", size = 9025090,
|
||||
contentType = "audio/mpeg", suffix = "mp3", duration = 225, bitRate = 320,
|
||||
path = "The Pretty Reckless/Going to Hell/03 Heaven Knows.mp3", isVideo = false,
|
||||
playCount = 2, discNumber = 1, created = parseDate("2016-10-23T21:30:40.000Z"),
|
||||
albumId = 388, artistId = 238, type = "music")
|
||||
albumId = "388", artistId = "238", type = "music")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,21 +27,21 @@ class SubsonicApiGetSongsByGenreTest : SubsonicAPIClientTest() {
|
||||
assertResponseSuccessful(response)
|
||||
response.body().songsList.size `should equal to` 2
|
||||
with(response.body().songsList) {
|
||||
this[0] `should equal` MusicDirectoryChild(id = 575, parent = 576, isDir = false,
|
||||
this[0] `should equal` MusicDirectoryChild(id = "575", parent = "576", isDir = false,
|
||||
title = "Time Machine (Vadim Zhukov Remix)", album = "668",
|
||||
artist = "Tasadi", year = 2008, genre = "Trance", size = 22467672,
|
||||
contentType = "audio/mpeg", suffix = "mp3", duration = 561, bitRate = 320,
|
||||
path = "Tasadi/668/00 Time Machine (Vadim Zhukov Remix).mp3",
|
||||
isVideo = false, playCount = 0, created = parseDate("2016-10-23T21:58:29.000Z"),
|
||||
albumId = 0, artistId = 0, type = "music")
|
||||
this[1] `should equal` MusicDirectoryChild(id = 621, parent = 622, isDir = false,
|
||||
albumId = "0", artistId = "0", type = "music")
|
||||
this[1] `should equal` MusicDirectoryChild(id = "621", parent = "622", isDir = false,
|
||||
title = "My Heart (Vadim Zhukov Remix)", album = "668",
|
||||
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"),
|
||||
albumId = 5, artistId = 4, type = "music")
|
||||
albumId = "5", artistId = "4", type = "music")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ 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,
|
||||
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,
|
||||
|
@ -51,15 +51,15 @@ class SubsonicApiJukeboxControlTest : SubsonicAPIClientTest() {
|
||||
gain `should equal to` 0.88f
|
||||
position `should equal to` 2
|
||||
playlistEntries.size `should equal to` 2
|
||||
playlistEntries[1] `should equal` MusicDirectoryChild(id = 4215L, parent = 4186L,
|
||||
playlistEntries[1] `should equal` MusicDirectoryChild(id = "4215", parent = "4186",
|
||||
isDir = false, title = "Going to Hell", album = "Going to Hell",
|
||||
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,
|
||||
created = parseDate("2016-10-23T21:30:41.000Z"), albumId = 388,
|
||||
artistId = 238, type = "music")
|
||||
created = parseDate("2016-10-23T21:30:41.000Z"), albumId = "388",
|
||||
artistId = "238", type = "music")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class SubsonicApiSearchTest : SubsonicAPIClientTest() {
|
||||
offset `should equal to` 10
|
||||
totalHits `should equal to` 53
|
||||
matchList.size `should equal to` 1
|
||||
matchList[0] `should equal` MusicDirectoryChild(id = 5831L, parent = 5766L,
|
||||
matchList[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",
|
||||
@ -41,8 +41,8 @@ class SubsonicApiSearchTest : SubsonicAPIClientTest() {
|
||||
bitRate = 192,
|
||||
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")
|
||||
created = parseDate("2016-10-23T20:09:02.000Z"), albumId = "568",
|
||||
artistId = "505", type = "music")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,15 +40,15 @@ class SubsonicApiSearchThreeTest : SubsonicAPIClientTest() {
|
||||
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",
|
||||
isVideo = false, playCount = 0, discNumber = 1,
|
||||
created = parseDate("2016-10-23T20:09:02.000Z"), albumId = 568,
|
||||
artistId = 505, type = "music")
|
||||
created = parseDate("2016-10-23T20:09:02.000Z"), albumId = "568",
|
||||
artistId = "505", type = "music")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,13 +33,13 @@ 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,
|
||||
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",
|
||||
@ -47,7 +47,7 @@ class SubsonicApiSearchTwoTest : SubsonicAPIClientTest() {
|
||||
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")
|
||||
albumId = "568", artistId = "505", type = "music")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,8 @@ package org.moire.ultrasonic.api.subsonic.models
|
||||
|
||||
import java.util.Calendar
|
||||
|
||||
data class MusicDirectoryChild(val id: Long = -1L,
|
||||
val parent: Long = -1L,
|
||||
data class MusicDirectoryChild(val id: String = "",
|
||||
val parent: String = "",
|
||||
val isDir: Boolean = false,
|
||||
val title: String = "",
|
||||
val album: String = "",
|
||||
@ -24,12 +24,12 @@ data class MusicDirectoryChild(val id: Long = -1L,
|
||||
val playCount: Int = 0,
|
||||
val discNumber: Int = -1,
|
||||
val created: Calendar? = null,
|
||||
val albumId: Long = -1,
|
||||
val artistId: Long = -1,
|
||||
val albumId: String = "",
|
||||
val artistId: String = "",
|
||||
val type: String = "",
|
||||
val starred: Calendar? = null,
|
||||
val streamId: Long = -1,
|
||||
val channelId: Long = -1,
|
||||
val streamId: String = "",
|
||||
val channelId: String = "",
|
||||
val description: String = "",
|
||||
val status: String = "",
|
||||
val publishDate: Calendar? = null,
|
||||
|
@ -15,14 +15,14 @@ internal val dateFormat: DateFormat by lazy {
|
||||
}
|
||||
|
||||
fun MusicDirectoryChild.toDomainEntity(): MusicDirectory.Entry = MusicDirectory.Entry().apply {
|
||||
id = this@toDomainEntity.id.toString()
|
||||
parent = this@toDomainEntity.parent.toString()
|
||||
id = this@toDomainEntity.id
|
||||
parent = this@toDomainEntity.parent
|
||||
setIsDirectory(this@toDomainEntity.isDir)
|
||||
title = this@toDomainEntity.title
|
||||
album = this@toDomainEntity.album
|
||||
albumId = this@toDomainEntity.albumId.toString()
|
||||
albumId = this@toDomainEntity.albumId
|
||||
artist = this@toDomainEntity.artist
|
||||
artistId = this@toDomainEntity.artistId.toString()
|
||||
artistId = this@toDomainEntity.artistId
|
||||
track = this@toDomainEntity.track
|
||||
year = this@toDomainEntity.year
|
||||
genre = this@toDomainEntity.genre
|
||||
@ -40,8 +40,8 @@ fun MusicDirectoryChild.toDomainEntity(): MusicDirectory.Entry = MusicDirectory.
|
||||
starred = this@toDomainEntity.starred != null
|
||||
discNumber = this@toDomainEntity.discNumber
|
||||
type = this@toDomainEntity.type
|
||||
if (this@toDomainEntity.streamId >= 0) {
|
||||
id = this@toDomainEntity.streamId.toString()
|
||||
if (this@toDomainEntity.streamId.isNotBlank()) {
|
||||
id = this@toDomainEntity.streamId
|
||||
}
|
||||
if (this@toDomainEntity.publishDate != null) {
|
||||
artist = dateFormat.format(this@toDomainEntity.publishDate!!.time)
|
||||
|
@ -16,7 +16,7 @@ class APIBookmarkConverterTest {
|
||||
@Test
|
||||
fun `Should convert to domain entity`() {
|
||||
val entity = Bookmark(412313L, "Awesemo", "Nice", Calendar.getInstance(),
|
||||
Calendar.getInstance(), MusicDirectoryChild(id = 12333))
|
||||
Calendar.getInstance(), MusicDirectoryChild(id = "12333"))
|
||||
|
||||
val domainEntity = entity.toDomainEntity()
|
||||
|
||||
|
@ -17,7 +17,7 @@ class APIMusicDirectoryConverterTest {
|
||||
fun `Should convert MusicDirectory entity`() {
|
||||
val entity = MusicDirectory(id = "1982", parent = "345", name = "some-name", userRating = 3,
|
||||
averageRating = 3.4f, starred = Calendar.getInstance(), playCount = 10,
|
||||
childList = listOf(MusicDirectoryChild(1L), MusicDirectoryChild(2L)))
|
||||
childList = listOf(MusicDirectoryChild("1"), MusicDirectoryChild("2")))
|
||||
|
||||
val convertedEntity = entity.toDomainEntity()
|
||||
|
||||
@ -30,8 +30,8 @@ class APIMusicDirectoryConverterTest {
|
||||
|
||||
@Test
|
||||
fun `Should convert MusicDirectoryChild entity`() {
|
||||
val entity = MusicDirectoryChild(id = 929L, parent = 11L, title = "some-title",
|
||||
album = "some-album", albumId = 231L, artist = "some-artist", artistId = 1233L,
|
||||
val entity = MusicDirectoryChild(id = "929", parent = "11", title = "some-title",
|
||||
album = "some-album", albumId = "231", artist = "some-artist", artistId = "1233",
|
||||
track = 12, year = 2002, genre = "some-genre", coverArt = "952", size = 9418123L,
|
||||
contentType = "some-content-type", suffix = "some-suffix",
|
||||
transcodedContentType = "some-transcoded-content-type",
|
||||
@ -42,14 +42,14 @@ class APIMusicDirectoryConverterTest {
|
||||
val convertedEntity = entity.toDomainEntity()
|
||||
|
||||
with(convertedEntity) {
|
||||
id `should equal to` entity.id.toString()
|
||||
parent `should equal to` entity.parent.toString()
|
||||
id `should equal to` entity.id
|
||||
parent `should equal to` entity.parent
|
||||
isDirectory `should equal to` entity.isDir
|
||||
title `should equal` entity.title
|
||||
album `should equal` entity.album
|
||||
albumId `should equal to` entity.albumId.toString()
|
||||
albumId `should equal to` entity.albumId
|
||||
artist `should equal to` entity.artist
|
||||
artistId `should equal to` entity.artistId.toString()
|
||||
artistId `should equal to` entity.artistId
|
||||
track `should equal to` entity.track
|
||||
year `should equal to` entity.year!!
|
||||
genre `should equal to` entity.genre
|
||||
@ -72,20 +72,20 @@ class APIMusicDirectoryConverterTest {
|
||||
|
||||
@Test
|
||||
fun `Should convert MusicDirectoryChild podcast entity`() {
|
||||
val entity = MusicDirectoryChild(id = 584, streamId = 394,
|
||||
val entity = MusicDirectoryChild(id = "584", streamId = "394",
|
||||
artist = "some-artist", publishDate = Calendar.getInstance())
|
||||
|
||||
val convertedEntity = entity.toDomainEntity()
|
||||
|
||||
with(convertedEntity) {
|
||||
id `should equal to` entity.streamId.toString()
|
||||
id `should equal to` entity.streamId
|
||||
artist `should equal to` dateFormat.format(entity.publishDate?.time)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Should convert list of MusicDirectoryChild to domain entity list`() {
|
||||
val entitiesList = listOf(MusicDirectoryChild(id = 45), MusicDirectoryChild(id = 34))
|
||||
val entitiesList = listOf(MusicDirectoryChild(id = "45"), MusicDirectoryChild(id = "34"))
|
||||
|
||||
val domainList = entitiesList.toDomainEntityList()
|
||||
|
||||
|
@ -16,8 +16,8 @@ class APIPlaylistConverterTest {
|
||||
@Test
|
||||
fun `Should convert Playlist to MusicDirectory domain entity`() {
|
||||
val entity = Playlist(name = "some-playlist-name", entriesList = listOf(
|
||||
MusicDirectoryChild(id = 10L, parent = 1393),
|
||||
MusicDirectoryChild(id = 11L, parent = 1393)
|
||||
MusicDirectoryChild(id = "10", parent = "1393"),
|
||||
MusicDirectoryChild(id = "11", parent = "1393")
|
||||
))
|
||||
|
||||
val convertedEntity = entity.toMusicDirectoryDomainEntity()
|
||||
|
@ -20,7 +20,7 @@ class APISearchConverterTest {
|
||||
@Test
|
||||
fun `Should convert SearchResult to domain entity`() {
|
||||
val entity = SearchResult(offset = 10, totalHits = 3, matchList = listOf(
|
||||
MusicDirectoryChild(id = 101L)
|
||||
MusicDirectoryChild(id = "101")
|
||||
))
|
||||
|
||||
val convertedEntity = entity.toDomainEntity()
|
||||
@ -40,9 +40,9 @@ class APISearchConverterTest {
|
||||
val entity = SearchTwoResult(listOf(
|
||||
Artist(id = "82", name = "great-artist-name")
|
||||
), listOf(
|
||||
MusicDirectoryChild(id = 762, artist = "bzz")
|
||||
MusicDirectoryChild(id = "762", artist = "bzz")
|
||||
), listOf(
|
||||
MusicDirectoryChild(id = 9118, parent = 112)
|
||||
MusicDirectoryChild(id = "9118", parent = "112")
|
||||
))
|
||||
|
||||
val convertedEntity = entity.toDomainEntity()
|
||||
@ -62,7 +62,7 @@ class APISearchConverterTest {
|
||||
val entity = SearchThreeResult(
|
||||
artistList = listOf(Artist(id = "612", name = "artist1")),
|
||||
albumList = listOf(Album(id = "221", name = "album1")),
|
||||
songList = listOf(MusicDirectoryChild(id = 7123, title = "song1"))
|
||||
songList = listOf(MusicDirectoryChild(id = "7123", title = "song1"))
|
||||
)
|
||||
|
||||
val convertedEntity = entity.toDomainEntity()
|
||||
|
Loading…
x
Reference in New Issue
Block a user