Convert Lyrics domain entity to kotlin.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2018-02-22 21:26:40 +01:00
parent a1f2132a17
commit 3dd7e531b9
4 changed files with 18 additions and 70 deletions

View File

@ -1,62 +0,0 @@
/*
This file is part of Subsonic.
Subsonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Subsonic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2010 (C) Sindre Mehus
*/
package org.moire.ultrasonic.domain;
/**
* Song lyrics.
*
* @author Sindre Mehus
*/
public class Lyrics
{
private String artist;
private String title;
private String text;
public String getArtist()
{
return artist;
}
public void setArtist(String artist)
{
this.artist = artist;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getText()
{
return text;
}
public void setText(String text)
{
this.text = text;
}
}

View File

@ -5,8 +5,8 @@ package org.moire.ultrasonic.domain
import org.moire.ultrasonic.api.subsonic.models.Lyrics as APILyrics
fun APILyrics.toDomainEntity(): Lyrics = Lyrics().apply {
artist = this@toDomainEntity.artist
title = this@toDomainEntity.title
fun APILyrics.toDomainEntity(): Lyrics = Lyrics(
artist = this@toDomainEntity.artist,
title = this@toDomainEntity.title,
text = this@toDomainEntity.text
}
)

View File

@ -0,0 +1,10 @@
package org.moire.ultrasonic.domain
/**
* Song lyrics.
*/
data class Lyrics(
val artist: String? = null,
val title: String? = null,
val text: String? = null
)

View File

@ -2,7 +2,7 @@
package org.moire.ultrasonic.domain
import org.amshove.kluent.`should equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Lyrics
@ -17,9 +17,9 @@ class APILyricsConverterTest {
val convertedEntity = entity.toDomainEntity()
with(convertedEntity) {
artist `should equal to` entity.artist
title `should equal to` entity.title
text `should equal to` entity.text
artist `should equal` entity.artist
title `should equal` entity.title
text `should equal` entity.text
}
}
}