Change PodcastChannel id type to String.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2017-12-16 20:51:07 +01:00
parent 434d07c4a3
commit 9cb6a5c4e9
4 changed files with 8 additions and 8 deletions

View File

@ -30,7 +30,7 @@ class SubsonicApiGetPodcastsTest : SubsonicAPIClientTest() {
val podcastChannelsList = response.body().podcastChannels val podcastChannelsList = response.body().podcastChannels
podcastChannelsList.size `should equal to` 1 podcastChannelsList.size `should equal to` 1
with(podcastChannelsList[0]) { with(podcastChannelsList[0]) {
id `should equal to` 2 id `should equal to` "2"
url `should equal to` "http://feeds.codenewbie.org/cnpodcast.xml" url `should equal to` "http://feeds.codenewbie.org/cnpodcast.xml"
title `should equal to` "CodeNewbie" 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."

View File

@ -3,7 +3,7 @@ package org.moire.ultrasonic.api.subsonic.models
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
data class PodcastChannel( data class PodcastChannel(
val id: Long = -1, val id: String = "",
val url: String = "", val url: String = "",
val title: String = "", val title: String = "",
val description: String = "", val description: String = "",

View File

@ -7,7 +7,7 @@ import org.moire.ultrasonic.api.subsonic.models.PodcastChannel
import org.moire.ultrasonic.domain.PodcastsChannel import org.moire.ultrasonic.domain.PodcastsChannel
fun PodcastChannel.toDomainEntity(): PodcastsChannel = PodcastsChannel( fun PodcastChannel.toDomainEntity(): PodcastsChannel = PodcastsChannel(
this.id.toString(), this.title, this.url, this.description, this.status) this.id, this.title, this.url, this.description, this.status)
fun List<PodcastChannel>.toDomainEntitiesList(): List<PodcastsChannel> = this fun List<PodcastChannel>.toDomainEntitiesList(): List<PodcastsChannel> = this
.map { it.toDomainEntity() } .map { it.toDomainEntity() }

View File

@ -8,19 +8,19 @@ import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.PodcastChannel import org.moire.ultrasonic.api.subsonic.models.PodcastChannel
/** /**
* Unit test for extension functions in [APIPodcastConverter.kt] file. * Unit test for extension functions in APIPodcastConverter.kt file.
*/ */
class APIPodcastConverterTest { class APIPodcastConverterTest {
@Test @Test
fun `Should convert podcast channel entity to domain entity`() { fun `Should convert podcast channel entity to domain entity`() {
val entity = PodcastChannel(id = 452L, url = "some-url", title = "some-title", val entity = PodcastChannel(id = "452", url = "some-url", title = "some-title",
description = "some-description", coverArt = "cA", originalImageUrl = "image-url", description = "some-description", coverArt = "cA", originalImageUrl = "image-url",
status = "podcast-status", errorMessage = "some-error-message") status = "podcast-status", errorMessage = "some-error-message")
val converterEntity = entity.toDomainEntity() val converterEntity = entity.toDomainEntity()
with(converterEntity) { with(converterEntity) {
id = entity.id.toString() id = entity.id
description = entity.description description = entity.description
status = entity.status status = entity.status
title = entity.title title = entity.title
@ -31,8 +31,8 @@ class APIPodcastConverterTest {
@Test @Test
fun `Should convert list of podcasts channels to domain entites list`() { fun `Should convert list of podcasts channels to domain entites list`() {
val entitiesList = listOf( val entitiesList = listOf(
PodcastChannel(id = 932L, title = "title1"), PodcastChannel(id = "932", title = "title1"),
PodcastChannel(id = 12L, title = "title2")) PodcastChannel(id = "12", title = "title2"))
val converted = entitiesList.toDomainEntitiesList() val converted = entitiesList.toDomainEntitiesList()