2017-09-02 19:40:32 +02:00
|
|
|
@file:Suppress("IllegalIdentifier")
|
|
|
|
|
2018-02-17 20:36:19 +01:00
|
|
|
package org.moire.ultrasonic.domain
|
2017-09-02 19:40:32 +02:00
|
|
|
|
2018-03-24 19:30:03 +01:00
|
|
|
import org.amshove.kluent.`should be equal to`
|
2017-09-02 19:40:32 +02:00
|
|
|
import org.junit.Test
|
|
|
|
import org.moire.ultrasonic.api.subsonic.models.MusicFolder
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unit test for extension functions in file APIMusicFolderConverter.kt.
|
|
|
|
*/
|
|
|
|
class APIMusicFolderConverterTest {
|
|
|
|
@Test
|
|
|
|
fun `Should convert MusicFolder entity`() {
|
2017-12-12 21:08:49 +01:00
|
|
|
val entity = MusicFolder(id = "10", name = "some-name")
|
2017-09-02 19:40:32 +02:00
|
|
|
|
|
|
|
val convertedEntity = entity.toDomainEntity()
|
|
|
|
|
2018-03-24 19:30:03 +01:00
|
|
|
convertedEntity.name `should be equal to` entity.name
|
|
|
|
convertedEntity.id `should be equal to` entity.id
|
2017-09-02 19:40:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `Should convert list of MusicFolder entities`() {
|
|
|
|
val entityList = listOf(
|
2020-06-13 19:04:31 +02:00
|
|
|
MusicFolder(id = "3", name = "some-name-3"),
|
|
|
|
MusicFolder(id = "4", name = "some-name-4")
|
|
|
|
)
|
2017-09-02 19:40:32 +02:00
|
|
|
|
|
|
|
val convertedList = entityList.toDomainEntityList()
|
|
|
|
|
|
|
|
with(convertedList) {
|
2018-03-24 19:30:03 +01:00
|
|
|
size `should be equal to` entityList.size
|
|
|
|
this[0].id `should be equal to` entityList[0].id
|
|
|
|
this[0].name `should be equal to` entityList[0].name
|
|
|
|
this[1].id `should be equal to` entityList[1].id
|
|
|
|
this[1].name `should be equal to` entityList[1].name
|
2017-09-02 19:40:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|