Change Share id type to String.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2017-12-16 20:54:43 +01:00
parent 9cb6a5c4e9
commit ad20064d79
5 changed files with 7 additions and 7 deletions

View File

@ -28,7 +28,7 @@ class SubsonicApiCreateShareTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response) assertResponseSuccessful(response)
response.body().shares.size `should equal to` 1 response.body().shares.size `should equal to` 1
with(response.body().shares[0]) { with(response.body().shares[0]) {
id `should equal to` 0 id `should equal to` "0"
url `should equal to` "https://subsonic.com/ext/share/awdwo?jwt=eyJhbGciOiJIUzI1NiJ9." + url `should equal to` "https://subsonic.com/ext/share/awdwo?jwt=eyJhbGciOiJIUzI1NiJ9." +
"eyJwYXRoIjoiL2V4dC9zaGFyZS9hd2R3byIsImV4cCI6MTU0MTYyNjQzMX0.iy8dkt_ZZc8hJ692" + "eyJwYXRoIjoiL2V4dC9zaGFyZS9hd2R3byIsImV4cCI6MTU0MTYyNjQzMX0.iy8dkt_ZZc8hJ692" +
"UxorHdHWFU2RB-fMCmCA4IJ_dTw" "UxorHdHWFU2RB-fMCmCA4IJ_dTw"

View File

@ -27,7 +27,7 @@ class SubsonicApiGetSharesTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response) assertResponseSuccessful(response)
response.body().shares.size `should equal to` 1 response.body().shares.size `should equal to` 1
with(response.body().shares[0]) { with(response.body().shares[0]) {
id `should equal to` 0 id `should equal to` "0"
url `should equal to` "https://subsonic.com/ext/share/awdwo?jwt=eyJhbGciOiJIUzI1" + url `should equal to` "https://subsonic.com/ext/share/awdwo?jwt=eyJhbGciOiJIUzI1" +
"NiJ9.eyJwYXRoIjoiL2V4dC9zaGFyZS9hd2R3byIsImV4cCI6MTU0MTYyNjQzMX0.iy8dkt_ZZc8" + "NiJ9.eyJwYXRoIjoiL2V4dC9zaGFyZS9hd2R3byIsImV4cCI6MTU0MTYyNjQzMX0.iy8dkt_ZZc8" +
"hJ692UxorHdHWFU2RB-fMCmCA4IJ_dTw" "hJ692UxorHdHWFU2RB-fMCmCA4IJ_dTw"

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
import java.util.Calendar import java.util.Calendar
data class Share( data class Share(
val id: Long = -1L, val id: String = "",
val url: String = "", val url: String = "",
val username: String = "", val username: String = "",
val created: Calendar? = null, val created: Calendar? = null,

View File

@ -17,7 +17,7 @@ fun APIShare.toDomainEntity(): Share = Share().apply {
created = this@toDomainEntity.created?.let { shareTimeFormat.format(it.time) } created = this@toDomainEntity.created?.let { shareTimeFormat.format(it.time) }
description = this@toDomainEntity.description description = this@toDomainEntity.description
expires = this@toDomainEntity.expires?.let { shareTimeFormat.format(it.time) } expires = this@toDomainEntity.expires?.let { shareTimeFormat.format(it.time) }
id = this@toDomainEntity.id.toString() id = this@toDomainEntity.id
lastVisited = this@toDomainEntity.lastVisited?.let { shareTimeFormat.format(it.time) } lastVisited = this@toDomainEntity.lastVisited?.let { shareTimeFormat.format(it.time) }
url = this@toDomainEntity.url url = this@toDomainEntity.url
username = this@toDomainEntity.username username = this@toDomainEntity.username

View File

@ -20,7 +20,7 @@ class APIShareConverterTest {
val domainEntity = entity.toDomainEntity() val domainEntity = entity.toDomainEntity()
with(domainEntity) { with(domainEntity) {
id `should equal to` entity.id.toString() id `should equal to` entity.id
url `should equal to` entity.url url `should equal to` entity.url
description `should equal to` entity.description description `should equal to` entity.description
username `should equal to` entity.username username `should equal to` entity.username
@ -33,7 +33,7 @@ class APIShareConverterTest {
} }
private fun createFakeShare(): Share { private fun createFakeShare(): Share {
return Share(id = 45L, url = "some-long-url", username = "Bender", return Share(id = "45", url = "some-long-url", username = "Bender",
created = Calendar.getInstance(), expires = Calendar.getInstance(), visitCount = 24, created = Calendar.getInstance(), expires = Calendar.getInstance(), visitCount = 24,
description = "Kiss my shiny metal ass", lastVisited = Calendar.getInstance(), description = "Kiss my shiny metal ass", lastVisited = Calendar.getInstance(),
items = listOf(MusicDirectoryChild())) items = listOf(MusicDirectoryChild()))
@ -43,7 +43,7 @@ class APIShareConverterTest {
fun `Should parse list of shares into domain entity list`() { fun `Should parse list of shares into domain entity list`() {
val entityList = listOf( val entityList = listOf(
createFakeShare(), createFakeShare(),
createFakeShare().copy(id = 554L, lastVisited = null)) createFakeShare().copy(id = "554", lastVisited = null))
val domainEntityList = entityList.toDomainEntitiesList() val domainEntityList = entityList.toDomainEntitiesList()