Merge branch 'develop' into lockscreen-controls

This commit is contained in:
Nite 2021-05-07 16:15:20 +02:00 committed by GitHub
commit ec21e14e33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 498 additions and 574 deletions

View File

@ -27,7 +27,6 @@ jobs:
command: |
./gradlew ciTest testDebugUnitTest
./gradlew jacocoFullReport
bash <(curl -s https://codecov.io/bash)
- run:
name: lint
command: ./gradlew :ultrasonic:lintRelease

View File

@ -42,6 +42,7 @@ See [CONTRIBUTING](CONTRIBUTING.md).
- [Subsonic](http://www.subsonic.org/pages/index.jsp)
- [Airsonic](https://github.com/airsonic/airsonic)
- [Supysonic](https://github.com/spl0k/supysonic)
- [Ampache](https://ampache.org/)
Other *Subsonic API* implementations should work as well as long as they follow API
[documentation](http://www.subsonic.org/pages/api.jsp).

View File

@ -3,7 +3,6 @@ package org.moire.ultrasonic.cache
import java.io.File
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should contain`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.cache.serializers.getMusicFolderSerializer
import org.moire.ultrasonic.domain.MusicFolder
@ -44,7 +43,7 @@ class PermanentFileStorageTest : BaseStorageTest() {
val loadedItem = storage.load(name, getMusicFolderSerializer())
loadedItem `should equal` item
loadedItem `should be equal to` item
}
@Test
@ -57,7 +56,7 @@ class PermanentFileStorageTest : BaseStorageTest() {
val loadedItem = storage.load(name, getMusicFolderSerializer())
loadedItem `should equal` item2
loadedItem `should be equal to` item2
}
@Test
@ -74,7 +73,7 @@ class PermanentFileStorageTest : BaseStorageTest() {
fun `Should return null if serialized file not available`() {
val loadedItem = storage.load("some-name", getMusicFolderSerializer())
loadedItem `should equal` null
loadedItem `should be equal to` null
}
private fun getServerStorageDir() = File(storageDir, serverId)

View File

@ -1,6 +1,6 @@
package org.moire.ultrasonic.cache.serializers
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.junit.Test
import org.moire.ultrasonic.cache.BaseStorageTest
import org.moire.ultrasonic.domain.Artist
@ -26,7 +26,7 @@ class ArtistSerializerTest : BaseStorageTest() {
val loadedItem = storage.load(itemName, getArtistsSerializer())
loadedItem `should equal` item
loadedItem `should be equal to` item
}
@Test
@ -52,6 +52,6 @@ class ArtistSerializerTest : BaseStorageTest() {
val loadedItems = storage.load(name, getArtistListSerializer())
loadedItems `should equal` itemsList
loadedItems `should be equal to` itemsList
}
}

View File

@ -1,6 +1,6 @@
package org.moire.ultrasonic.cache.serializers
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.junit.Test
import org.moire.ultrasonic.cache.BaseStorageTest
import org.moire.ultrasonic.domain.Artist
@ -33,6 +33,6 @@ class IndexesSerializerTest : BaseStorageTest() {
val loadedItem = storage.load(name, getIndexesSerializer())
loadedItem `should equal` item
loadedItem `should be equal to` item
}
}

View File

@ -1,6 +1,6 @@
package org.moire.ultrasonic.cache.serializers
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.junit.Test
import org.moire.ultrasonic.cache.BaseStorageTest
import org.moire.ultrasonic.domain.MusicFolder
@ -26,7 +26,7 @@ class MusicFolderSerializerTest : BaseStorageTest() {
val loadedItem = storage.load(name, getMusicFolderSerializer())
loadedItem `should equal` item
loadedItem `should be equal to` item
}
@Test
@ -52,6 +52,6 @@ class MusicFolderSerializerTest : BaseStorageTest() {
val loadedItem = storage.load(name, getMusicFolderListSerializer())
loadedItem `should equal` itemsList
loadedItem `should be equal to` itemsList
}
}

View File

@ -5,6 +5,3 @@ ext {
'**/domain/**'
]
}
dependencies {
api other.semver
}

View File

@ -1,27 +0,0 @@
package org.moire.ultrasonic.domain
import net.swiftzer.semver.SemVer
/**
* Represents the version number of the Subsonic Android app.
*/
data class Version(
val version: SemVer
) : Comparable<Version> {
override fun compareTo(other: Version): Int {
return version.compareTo(other.version)
}
companion object {
/**
* Creates a new version instance by parsing the given string.
*
* @param version A string of the format "1.27", "1.27.2" or "1.27.beta3".
*/
@JvmStatic
fun fromCharSequence(version: String): Version {
return Version(SemVer.parse(version))
}
}
}

View File

@ -6,10 +6,10 @@ import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.whenever
import com.squareup.picasso.Picasso
import com.squareup.picasso.Request
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should not be`
import org.amshove.kluent.`should throw`
import org.amshove.kluent.shouldEqualTo
import org.amshove.kluent.shouldBeEqualTo
import org.junit.Test
import org.junit.runner.RunWith
import org.moire.ultrasonic.api.subsonic.SubsonicAPIClient
@ -27,7 +27,7 @@ class AvatarRequestHandlerTest {
fun `Should accept only cover art request`() {
val requestUri = createLoadAvatarRequest("some-username")
handler.canHandleRequest(requestUri.buildRequest()) shouldEqualTo true
handler.canHandleRequest(requestUri.buildRequest()) shouldBeEqualTo true
}
@Test
@ -38,7 +38,7 @@ class AvatarRequestHandlerTest {
.appendPath("something")
.build()
handler.canHandleRequest(requestUri.buildRequest()) shouldEqualTo false
handler.canHandleRequest(requestUri.buildRequest()) shouldBeEqualTo false
}
@Test
@ -65,7 +65,7 @@ class AvatarRequestHandlerTest {
val response = handler.load(createLoadAvatarRequest("some-username").buildRequest(), 0)
response.loadedFrom `should equal` Picasso.LoadedFrom.NETWORK
response.loadedFrom `should be equal to` Picasso.LoadedFrom.NETWORK
response.source `should not be` null
}

View File

@ -8,10 +8,10 @@ import com.nhaarman.mockito_kotlin.whenever
import com.squareup.picasso.Picasso
import com.squareup.picasso.Request
import java.io.IOException
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should not be`
import org.amshove.kluent.`should throw`
import org.amshove.kluent.shouldEqualTo
import org.amshove.kluent.shouldBeEqualTo
import org.junit.Test
import org.junit.runner.RunWith
import org.moire.ultrasonic.api.subsonic.SubsonicAPIClient
@ -27,7 +27,7 @@ class CoverArtRequestHandlerTest {
fun `Should accept only cover art request`() {
val requestUri = createLoadCoverArtRequest("some-id")
handler.canHandleRequest(requestUri.buildRequest()) shouldEqualTo true
handler.canHandleRequest(requestUri.buildRequest()) shouldBeEqualTo true
}
@Test
@ -38,7 +38,7 @@ class CoverArtRequestHandlerTest {
.appendPath("random")
.build()
handler.canHandleRequest(requestUri.buildRequest()) shouldEqualTo false
handler.canHandleRequest(requestUri.buildRequest()) shouldBeEqualTo false
}
@Test
@ -78,7 +78,7 @@ class CoverArtRequestHandlerTest {
val response = handler.load(createLoadCoverArtRequest("some").buildRequest(), 0)
response.loadedFrom `should equal` Picasso.LoadedFrom.NETWORK
response.loadedFrom `should be equal to` Picasso.LoadedFrom.NETWORK
response.source `should not be` null
}

View File

@ -1,7 +1,7 @@
package org.moire.ultrasonic.subsonic.loader.image
import android.net.Uri
import org.amshove.kluent.shouldEqualTo
import org.amshove.kluent.shouldBeEqualTo
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
@ -13,7 +13,7 @@ class RequestCreatorTest {
val entityId = "299"
val expectedUri = Uri.parse("$SCHEME://$AUTHORITY/$COVER_ART_PATH?$QUERY_ID=$entityId")
createLoadCoverArtRequest(entityId).compareTo(expectedUri).shouldEqualTo(0)
createLoadCoverArtRequest(entityId).compareTo(expectedUri).shouldBeEqualTo(0)
}
@Test
@ -21,6 +21,6 @@ class RequestCreatorTest {
val username = "some-username"
val expectedUri = Uri.parse("$SCHEME://$AUTHORITY/$AVATAR_PATH?$QUERY_USERNAME=$username")
createLoadAvatarRequest(username).compareTo(expectedUri).shouldEqualTo(0)
createLoadAvatarRequest(username).compareTo(expectedUri).shouldBeEqualTo(0)
}
}

View File

@ -2,7 +2,6 @@ package org.moire.ultrasonic.api.subsonic
import java.util.Calendar
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
@ -16,7 +15,7 @@ class SubsonicApiCreateShareTest : SubsonicAPIClientTest() {
client.api.createShare(listOf("some-id")).execute()
}
response.shares `should equal` emptyList()
response.shares `should be equal to` emptyList()
}
@Test
@ -34,13 +33,13 @@ class SubsonicApiCreateShareTest : SubsonicAPIClientTest() {
"eyJwYXRoIjoiL2V4dC9zaGFyZS9hd2R3byIsImV4cCI6MTU0MTYyNjQzMX0.iy8dkt_ZZc8hJ692" +
"UxorHdHWFU2RB-fMCmCA4IJ_dTw"
username `should be equal to` "admin"
created `should equal` parseDate("2017-11-07T21:33:51.748Z")
expires `should equal` parseDate("2018-11-07T21:33:51.748Z")
lastVisited `should equal` parseDate("2018-11-07T21:33:51.748Z")
created `should be equal to` parseDate("2017-11-07T21:33:51.748Z")
expires `should be equal to` parseDate("2018-11-07T21:33:51.748Z")
lastVisited `should be equal to` parseDate("2018-11-07T21:33:51.748Z")
description `should be equal to` "Awesome link!"
visitCount `should be equal to` 0
items.size `should be equal to` 1
items[0] `should equal` MusicDirectoryChild(
items[0] `should be equal to` 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,

View File

@ -1,7 +1,7 @@
package org.moire.ultrasonic.api.subsonic
import java.io.IOException
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should not be`
import org.amshove.kluent.`should throw`
import org.junit.Test
@ -152,6 +152,6 @@ class SubsonicApiErrorsTest : SubsonicAPIClientTest() {
private fun Response<SubsonicResponse>.assertError(expectedError: SubsonicError) =
with(body()!!) {
error `should not be` null
error `should equal` expectedError
error `should be equal to` expectedError
}
}

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Album
import org.moire.ultrasonic.api.subsonic.models.AlbumListType
@ -18,7 +17,7 @@ class SubsonicApiGetAlbumList2Test : SubsonicAPIClientTest() {
client.api.getAlbumList2(STARRED).execute()
}
response.albumList `should equal` emptyList()
response.albumList `should be equal to` emptyList()
}
@Test
@ -30,13 +29,13 @@ class SubsonicApiGetAlbumList2Test : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body()!!.albumList) {
this.size `should be equal to` 2
this[0] `should equal` Album(
this[0] `should be equal to` Album(
id = "962", name = "Fury", artist = "Sick Puppies",
artistId = "473", coverArt = "al-962", songCount = 13, duration = 2591,
created = parseDate("2017-09-02T17:34:51.000Z"), year = 2016,
genre = "Alternative Rock"
)
this[1] `should equal` Album(
this[1] `should be equal to` Album(
id = "961", name = "Endless Forms Most Beautiful",
artist = "Nightwish", artistId = "559", coverArt = "al-961", songCount = 22,
duration = 9469, created = parseDate("2017-09-02T16:22:47.000Z"),

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.AlbumListType
import org.moire.ultrasonic.api.subsonic.models.AlbumListType.BY_GENRE
@ -17,7 +16,7 @@ class SubsonicApiGetAlbumListRequestTest : SubsonicAPIClientTest() {
client.api.getAlbumList(BY_GENRE).execute()
}
response.albumList `should equal` emptyList()
response.albumList `should be equal to` emptyList()
}
@Test
@ -29,7 +28,7 @@ class SubsonicApiGetAlbumListRequestTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body()!!.albumList) {
size `should be equal to` 2
this[1] `should equal` MusicDirectoryChild(
this[1] `should be equal to` MusicDirectoryChild(
id = "9997", parent = "9996", isDir = true,
title = "Endless Forms Most Beautiful", album = "Endless Forms Most Beautiful",
artist = "Nightwish", year = 2015, genre = "Symphonic Metal",

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not be`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Album
@ -18,7 +17,7 @@ class SubsonicApiGetAlbumTest : SubsonicAPIClientTest() {
}
response.album `should not be` null
response.album `should equal` Album()
response.album `should be equal to` Album()
}
@Test
@ -48,11 +47,11 @@ class SubsonicApiGetAlbumTest : SubsonicAPIClientTest() {
coverArt `should be equal to` "al-618"
songCount `should be equal to` 15
duration `should be equal to` 3331
created `should equal` parseDate("2016-10-23T15:31:22.000Z")
created `should be equal to` parseDate("2016-10-23T15:31:22.000Z")
year `should be equal to` 2008
genre `should be equal to` "Hard Rock"
songList.size `should be equal to` 15
songList[0] `should equal` MusicDirectoryChild(
songList[0] `should be equal to` 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",
@ -63,7 +62,7 @@ class SubsonicApiGetAlbumTest : SubsonicAPIClientTest() {
created = parseDate("2016-10-23T15:31:20.000Z"),
albumId = "618", artistId = "362", type = "music"
)
songList[5] `should equal` MusicDirectoryChild(
songList[5] `should be equal to` 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,

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not be`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Album
@ -18,7 +17,7 @@ class SubsonicApiGetArtistTest : SubsonicAPIClientTest() {
}
response.artist `should not be` null
response.artist `should equal` Artist()
response.artist `should be equal to` Artist()
}
@Test
@ -46,13 +45,13 @@ class SubsonicApiGetArtistTest : SubsonicAPIClientTest() {
coverArt `should be equal to` "ar-362"
albumCount `should be equal to` 2
albumsList.size `should be equal to` 2
albumsList[0] `should equal` Album(
albumsList[0] `should be equal to` Album(
id = "618", name = "Black Ice", artist = "AC/DC",
artistId = "362", coverArt = "al-618", songCount = 15, duration = 3331,
created = parseDate("2016-10-23T15:31:22.000Z"),
year = 2008, genre = "Hard Rock"
)
albumsList[1] `should equal` Album(
albumsList[1] `should be equal to` Album(
id = "617", name = "Rock or Bust", artist = "AC/DC",
artistId = "362", coverArt = "al-617", songCount = 11, duration = 2095,
created = parseDate("2016-10-23T15:31:23.000Z"),

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not be`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Artist
@ -19,7 +18,7 @@ class SubsonicApiGetArtistsTest : SubsonicAPIClientTest() {
}
response.indexes `should not be` null
response.indexes `should equal` Indexes()
response.indexes `should be equal to` Indexes()
}
@Test
@ -32,9 +31,9 @@ class SubsonicApiGetArtistsTest : SubsonicAPIClientTest() {
with(response.body()!!.indexes) {
lastModified `should be equal to` 0L
ignoredArticles `should be equal to` "The El La Los Las Le Les"
shortcutList `should equal` emptyList()
shortcutList `should be equal to` emptyList()
indexList.size `should be equal to` 2
indexList `should equal` listOf(
indexList `should be equal to` listOf(
Index(
name = "A",
artists = listOf(

View File

@ -3,7 +3,6 @@ package org.moire.ultrasonic.api.subsonic
import okhttp3.mockwebserver.MockResponse
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should be`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not be`
import org.junit.Test
@ -20,7 +19,7 @@ class SubsonicApiGetAvatarTest : SubsonicAPIClientTest() {
with(response) {
stream `should be` null
responseHttpCode `should be equal to` 200
apiError `should equal` SubsonicError.RequestedDataWasNotFound
apiError `should be equal to` SubsonicError.RequestedDataWasNotFound
}
}
@ -32,7 +31,7 @@ class SubsonicApiGetAvatarTest : SubsonicAPIClientTest() {
val response = client.getAvatar("some")
with(response) {
stream `should equal` null
stream `should be equal to` null
responseHttpCode `should be equal to` httpErrorCode
apiError `should be` null
}

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
@ -15,7 +14,7 @@ class SubsonicApiGetBookmarksTest : SubsonicAPIClientTest() {
client.api.getBookmarks().execute()
}
response.bookmarkList `should equal` emptyList()
response.bookmarkList `should be equal to` emptyList()
}
@Test
@ -30,9 +29,9 @@ class SubsonicApiGetBookmarksTest : SubsonicAPIClientTest() {
position `should be equal to` 107914
username `should be equal to` "CaptainEurope"
comment `should be 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(
created `should be equal to` parseDate("2017-11-18T15:22:22.144Z")
changed `should be equal to` parseDate("2017-11-18T15:22:22.144Z")
entry `should be equal to` 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",

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.ChatMessage
@ -15,7 +14,7 @@ class SubsonicApiGetChatMessagesTest : SubsonicAPIClientTest() {
client.api.getChatMessages().execute()
}
response.chatMessages `should equal` emptyList()
response.chatMessages `should be equal to` emptyList()
}
@Test
@ -27,11 +26,11 @@ class SubsonicApiGetChatMessagesTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body()!!.chatMessages) {
size `should be equal to` 2
this[0] `should equal` ChatMessage(
this[0] `should be equal to` ChatMessage(
username = "sindre", time = 1269771845310,
message = "Sindre was here"
)
this[1] `should equal` ChatMessage(
this[1] `should be equal to` ChatMessage(
username = "ben", time = 1269771842504,
message = "Ben too"
)

View File

@ -3,7 +3,6 @@ package org.moire.ultrasonic.api.subsonic
import okhttp3.mockwebserver.MockResponse
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should be`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not be`
import org.junit.Test
@ -20,7 +19,7 @@ class SubsonicApiGetCoverArtTest : SubsonicAPIClientTest() {
with(response) {
stream `should be` null
responseHttpCode `should be equal to` 200
apiError `should equal` SubsonicError.RequestedDataWasNotFound
apiError `should be equal to` SubsonicError.RequestedDataWasNotFound
}
}
@ -33,7 +32,7 @@ class SubsonicApiGetCoverArtTest : SubsonicAPIClientTest() {
with(response) {
stream `should be` null
responseHttpCode `should equal` 404
responseHttpCode `should be equal to` 404
apiError `should be` null
}
}

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Genre
@ -15,7 +14,7 @@ class SubsonicApiGetGenresTest : SubsonicAPIClientTest() {
client.api.getGenres().execute()
}
response.genresList `should equal` emptyList()
response.genresList `should be equal to` emptyList()
}
@Test
@ -27,11 +26,11 @@ class SubsonicApiGetGenresTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body()!!.genresList) {
size `should be equal to` 5
this[0] `should equal` Genre(1186, 103, "Rock")
this[1] `should equal` Genre(896, 72, "Electronic")
this[2] `should equal` Genre(790, 59, "Alternative Rock")
this[3] `should equal` Genre(622, 97, "Trance")
this[4] `should equal` Genre(476, 36, "Hard Rock")
this[0] `should be equal to` Genre(1186, 103, "Rock")
this[1] `should be equal to` Genre(896, 72, "Electronic")
this[2] `should be equal to` Genre(790, 59, "Alternative Rock")
this[3] `should be equal to` Genre(622, 97, "Trance")
this[4] `should be equal to` Genre(476, 36, "Hard Rock")
}
}
}

View File

@ -1,6 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should not be`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Artist
@ -20,13 +20,13 @@ class SubsonicApiGetIndexesTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
response.body()!!.indexes `should not be` null
with(response.body()!!.indexes) {
lastModified `should equal` 1491069027523
ignoredArticles `should equal` "The El La Los Las Le Les"
shortcutList `should equal` listOf(
lastModified `should be equal to` 1491069027523
ignoredArticles `should be equal to` "The El La Los Las Le Les"
shortcutList `should be equal to` listOf(
Artist(id = "889", name = "podcasts"),
Artist(id = "890", name = "audiobooks")
)
indexList `should equal` mutableListOf(
indexList `should be equal to` mutableListOf(
Index(
"A",
listOf(
@ -79,6 +79,6 @@ class SubsonicApiGetIndexesTest : SubsonicAPIClientTest() {
}
response.indexes `should not be` null
response.indexes `should equal` Indexes()
response.indexes `should be equal to` Indexes()
}
}

View File

@ -1,6 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should not be`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.License
@ -18,7 +18,7 @@ class SubsonicApiGetLicenseTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body()!!) {
assertBaseResponseOk()
license `should equal` License(
license `should be equal to` License(
valid = true,
trialExpires = parseDate("2016-11-23T20:17:15.206Z"),
email = "someone@example.net",
@ -34,7 +34,7 @@ class SubsonicApiGetLicenseTest : SubsonicAPIClientTest() {
}
response.license `should not be` null
response.license.email `should equal` License().email
response.license.valid `should equal` License().valid
response.license.email `should be equal to` License().email
response.license.valid `should be equal to` License().valid
}
}

View File

@ -2,7 +2,6 @@ package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should be`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not be`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectory
@ -19,7 +18,7 @@ class SubsonicApiGetMusicDirectoryTest : SubsonicAPIClientTest() {
}
response.musicDirectory `should not be` null
response.musicDirectory `should equal` MusicDirectory()
response.musicDirectory `should be equal to` MusicDirectory()
}
@Test
@ -46,13 +45,13 @@ class SubsonicApiGetMusicDirectoryTest : SubsonicAPIClientTest() {
with(response.body()!!.musicDirectory) {
id `should be equal to` "4836"
parent `should be equal to` "300"
name `should equal` "12 Stones"
name `should be equal to` "12 Stones"
userRating `should be equal to` 5
averageRating `should be equal to` 5.0f
starred `should equal` null
starred `should be equal to` null
playCount `should be equal to` 1
childList.size `should be` 2
childList[0] `should equal` MusicDirectoryChild(
childList[0] `should be equal to` MusicDirectoryChild(
id = "4844", parent = "4836",
isDir = false, title = "Crash", album = "12 Stones", artist = "12 Stones",
track = 1, year = 2002, genre = "Alternative Rock", coverArt = "4836",
@ -62,7 +61,7 @@ class SubsonicApiGetMusicDirectoryTest : SubsonicAPIClientTest() {
created = parseDate("2016-10-23T15:19:10.000Z"),
albumId = "454", artistId = "288", type = "music"
)
childList[1] `should equal` MusicDirectoryChild(
childList[1] `should be equal to` MusicDirectoryChild(
id = "4845", parent = "4836",
isDir = false, title = "Broken", album = "12 Stones", artist = "12 Stones",
track = 2, year = 2002, genre = "Alternative Rock", coverArt = "4836",

View File

@ -1,6 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicFolder
@ -17,7 +17,7 @@ class SubsonicApiGetMusicFoldersTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body()!!) {
assertBaseResponseOk()
musicFolders `should equal` listOf(
musicFolders `should be equal to` listOf(
MusicFolder("0", "Music"),
MusicFolder("2", "Test")
)
@ -30,6 +30,6 @@ class SubsonicApiGetMusicFoldersTest : SubsonicAPIClientTest() {
client.api.getMusicFolders().execute()
}
response.musicFolders `should equal` emptyList()
response.musicFolders `should be equal to` emptyList()
}
}

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not be`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
@ -18,7 +17,7 @@ class SubsonicApiGetPlaylistTest : SubsonicAPIClientTest() {
}
response.playlist `should not be` null
response.playlist `should equal` Playlist()
response.playlist `should be equal to` Playlist()
}
@Test
@ -35,11 +34,11 @@ class SubsonicApiGetPlaylistTest : SubsonicAPIClientTest() {
public `should be equal to` false
songCount `should be equal to` 16
duration `should be equal to` 3573
created `should equal` parseDate("2017-08-27T11:17:26.216Z")
changed `should equal` parseDate("2017-08-27T11:17:26.218Z")
created `should be equal to` parseDate("2017-08-27T11:17:26.216Z")
changed `should be equal to` parseDate("2017-08-27T11:17:26.218Z")
coverArt `should be equal to` "pl-0"
entriesList.size `should be equal to` 2
entriesList[1] `should equal` MusicDirectoryChild(
entriesList[1] `should be equal to` MusicDirectoryChild(
id = "4215", parent = "4186",
isDir = false, title = "Going to Hell", album = "Going to Hell",
artist = "The Pretty Reckless", track = 2, year = 2014,

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not be`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Playlist
@ -17,7 +16,7 @@ class SubsonicApiGetPlaylistsTest : SubsonicAPIClientTest() {
}
response.playlists `should not be` null
response.playlists `should equal` emptyList()
response.playlists `should be equal to` emptyList()
}
@Test
@ -29,7 +28,7 @@ class SubsonicApiGetPlaylistsTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body()!!.playlists) {
size `should be equal to` 1
this[0] `should equal` Playlist(
this[0] `should be equal to` Playlist(
id = "0", name = "Aug 27, 2017 11:17 AM",
owner = "admin", public = false, songCount = 16, duration = 3573,
comment = "Some comment",

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not be`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
@ -17,7 +16,7 @@ class SubsonicApiGetPodcastsTest : SubsonicAPIClientTest() {
}
response.podcastChannels `should not be` null
response.podcastChannels `should equal` emptyList()
response.podcastChannels `should be equal to` emptyList()
}
@Test
@ -41,7 +40,7 @@ class SubsonicApiGetPodcastsTest : SubsonicAPIClientTest() {
status `should be equal to` "completed"
errorMessage `should be equal to` ""
episodeList.size `should be equal to` 10
episodeList[0] `should equal` MusicDirectoryChild(
episodeList[0] `should be equal to` MusicDirectoryChild(
id = "148", parent = "9959",
isDir = false,
title = "S1:EP3 How to teach yourself computer science (Vaidehi Joshi)",

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
@ -15,7 +14,7 @@ class SubsonicApiGetRandomSongsTest : SubsonicAPIClientTest() {
client.api.getRandomSongs().execute()
}
response.songsList `should equal` emptyList()
response.songsList `should be equal to` emptyList()
}
@Test
@ -27,7 +26,7 @@ class SubsonicApiGetRandomSongsTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body()!!.songsList) {
size `should be equal to` 3
this[1] `should equal` MusicDirectoryChild(
this[1] `should be equal to` 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",

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
@ -15,7 +14,7 @@ class SubsonicApiGetSharesTest : SubsonicAPIClientTest() {
client.api.getShares().execute()
}
response.shares `should equal` emptyList()
response.shares `should be equal to` emptyList()
}
@Test
@ -32,13 +31,13 @@ class SubsonicApiGetSharesTest : SubsonicAPIClientTest() {
"NiJ9.eyJwYXRoIjoiL2V4dC9zaGFyZS9hd2R3byIsImV4cCI6MTU0MTYyNjQzMX0.iy8dkt_ZZc8" +
"hJ692UxorHdHWFU2RB-fMCmCA4IJ_dTw"
username `should be equal to` "admin"
created `should equal` parseDate("2017-11-07T21:33:51.748Z")
expires `should equal` parseDate("2018-11-07T21:33:51.748Z")
lastVisited `should equal` parseDate("2018-11-07T21:33:51.748Z")
created `should be equal to` parseDate("2017-11-07T21:33:51.748Z")
expires `should be equal to` parseDate("2018-11-07T21:33:51.748Z")
lastVisited `should be equal to` parseDate("2018-11-07T21:33:51.748Z")
visitCount `should be equal to` 0
description `should be equal to` "Awesome link!"
items.size `should be equal to` 1
items[0] `should equal` MusicDirectoryChild(
items[0] `should be equal to` 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,

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
@ -15,7 +14,7 @@ class SubsonicApiGetSongsByGenreTest : SubsonicAPIClientTest() {
client.api.getSongsByGenre("Metal").execute()
}
response.songsList `should equal` emptyList()
response.songsList `should be equal to` emptyList()
}
@Test
@ -27,7 +26,7 @@ class SubsonicApiGetSongsByGenreTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
response.body()!!.songsList.size `should be equal to` 2
with(response.body()!!.songsList) {
this[0] `should equal` MusicDirectoryChild(
this[0] `should be equal to` MusicDirectoryChild(
id = "575", parent = "576", isDir = false,
title = "Time Machine (Vadim Zhukov Remix)", album = "668",
artist = "Tasadi", year = 2008, genre = "Trance", size = 22467672,
@ -36,7 +35,7 @@ class SubsonicApiGetSongsByGenreTest : SubsonicAPIClientTest() {
isVideo = false, playCount = 0, created = parseDate("2016-10-23T21:58:29.000Z"),
albumId = "0", artistId = "0", type = "music"
)
this[1] `should equal` MusicDirectoryChild(
this[1] `should be equal to` 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",

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Artist
import org.moire.ultrasonic.api.subsonic.models.SearchTwoResult
@ -17,7 +16,7 @@ class SubsonicApiGetStarred2Test : SubsonicAPIClientTest() {
client.api.getStarred2().execute()
}
response.starred2 `should equal` SearchTwoResult()
response.starred2 `should be equal to` SearchTwoResult()
}
@Test
@ -28,13 +27,13 @@ class SubsonicApiGetStarred2Test : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body()!!.starred2) {
albumList `should equal` emptyList()
albumList `should be equal to` emptyList()
artistList.size `should be equal to` 1
artistList[0] `should equal` Artist(
artistList[0] `should be equal to` Artist(
id = "364", name = "Parov Stelar",
starred = parseDate("2017-08-12T18:32:58.768Z")
)
songList `should equal` emptyList()
songList `should be equal to` emptyList()
}
}

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Artist
import org.moire.ultrasonic.api.subsonic.models.SearchTwoResult
@ -16,7 +15,7 @@ class SubsonicApiGetStarredTest : SubsonicAPIClientTest() {
client.api.getStarred().execute()
}
response.starred `should equal` SearchTwoResult()
response.starred `should be equal to` SearchTwoResult()
}
@Test
@ -27,13 +26,13 @@ class SubsonicApiGetStarredTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body()!!.starred) {
albumList `should equal` emptyList()
albumList `should be equal to` emptyList()
artistList.size `should be equal to` 1
artistList[0] `should equal` Artist(
artistList[0] `should be equal to` Artist(
id = "364", name = "Parov Stelar",
starred = parseDate("2017-08-12T18:32:58.768Z")
)
songList `should equal` emptyList()
songList `should be equal to` emptyList()
}
}

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.User
@ -15,7 +14,7 @@ class SubsonicApiGetUserTest : SubsonicAPIClientTest() {
client.api.getUser("some").execute()
}
response.user `should equal` User()
response.user `should be equal to` User()
}
@Test

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
@ -15,7 +14,7 @@ class SubsonicApiGetVideosListTest : SubsonicAPIClientTest() {
client.api.getVideos().execute()
}
response.videosList `should equal` emptyList()
response.videosList `should be equal to` emptyList()
}
@Test
@ -27,7 +26,7 @@ class SubsonicApiGetVideosListTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body()!!.videosList) {
size `should be equal to` 1
this[0] `should equal` MusicDirectoryChild(
this[0] `should be equal to` MusicDirectoryChild(
id = "10402", parent = "10401",
isDir = false, title = "MVI_0512", album = "Incoming", size = 21889646,
contentType = "video/avi", suffix = "avi",

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.JukeboxAction
import org.moire.ultrasonic.api.subsonic.models.JukeboxAction.GET
@ -19,7 +18,7 @@ class SubsonicApiJukeboxControlTest : SubsonicAPIClientTest() {
client.api.jukeboxControl(GET).execute()
}
response.jukebox `should equal` JukeboxStatus()
response.jukebox `should be equal to` JukeboxStatus()
}
@Test
@ -34,7 +33,7 @@ class SubsonicApiJukeboxControlTest : SubsonicAPIClientTest() {
playing `should be equal to` true
gain `should be equal to` 0.32f
position `should be equal to` 3
playlistEntries `should equal` emptyList()
playlistEntries `should be equal to` emptyList()
}
}
@ -51,7 +50,7 @@ class SubsonicApiJukeboxControlTest : SubsonicAPIClientTest() {
gain `should be equal to` 0.88f
position `should be equal to` 2
playlistEntries.size `should be equal to` 2
playlistEntries[1] `should equal` MusicDirectoryChild(
playlistEntries[1] `should be equal to` 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",

View File

@ -45,7 +45,7 @@ class SubsonicApiSSLTest {
certificatePkcs12Stream: InputStream,
password: String
): SSLContext {
var cert: X509Certificate? = null
var cert: X509Certificate?
val trustStore = KeyStore.getInstance(KeyStore.getDefaultType())
trustStore.load(null)

View File

@ -2,7 +2,6 @@ package org.moire.ultrasonic.api.subsonic
import java.util.Calendar
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not be`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
@ -19,7 +18,7 @@ class SubsonicApiSearchTest : SubsonicAPIClientTest() {
}
response.searchResult `should not be` null
response.searchResult `should equal` SearchResult()
response.searchResult `should be equal to` SearchResult()
}
@Test
@ -33,7 +32,7 @@ class SubsonicApiSearchTest : SubsonicAPIClientTest() {
offset `should be equal to` 10
totalHits `should be equal to` 53
matchList.size `should be equal to` 1
matchList[0] `should equal` MusicDirectoryChild(
matchList[0] `should be equal to` MusicDirectoryChild(
id = "5831", parent = "5766",
isDir = false, title = "You'll Be Under My Wheels",
album = "Need for Speed Most Wanted", artist = "The Prodigy",

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not be`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Album
@ -20,7 +19,7 @@ class SubsonicApiSearchThreeTest : SubsonicAPIClientTest() {
}
response.searchResult `should not be` null
response.searchResult `should equal` SearchThreeResult()
response.searchResult `should be equal to` SearchThreeResult()
}
@Test
@ -32,12 +31,12 @@ class SubsonicApiSearchThreeTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body()!!.searchResult) {
artistList.size `should be equal to` 1
artistList[0] `should equal` Artist(
artistList[0] `should be equal to` Artist(
id = "505", name = "The Prodigy",
coverArt = "ar-505", albumCount = 5
)
albumList.size `should be equal to` 1
albumList[0] `should equal` Album(
albumList[0] `should be equal to` Album(
id = "855",
name = "Always Outnumbered, Never Outgunned",
artist = "The Prodigy", artistId = "505", coverArt = "al-855", songCount = 12,
@ -45,7 +44,7 @@ class SubsonicApiSearchThreeTest : SubsonicAPIClientTest() {
year = 2004, genre = "Electronic"
)
songList.size `should be equal to` 1
songList[0] `should equal` MusicDirectoryChild(
songList[0] `should be equal to` MusicDirectoryChild(
id = "5831", parent = "5766",
isDir = false,
title = "You'll Be Under My Wheels", album = "Need for Speed Most Wanted",

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not be`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Artist
@ -19,7 +18,7 @@ class SubsonicApiSearchTwoTest : SubsonicAPIClientTest() {
}
response.searchResult `should not be` null
response.searchResult `should equal` SearchTwoResult()
response.searchResult `should be equal to` SearchTwoResult()
}
@Test
@ -31,9 +30,9 @@ class SubsonicApiSearchTwoTest : SubsonicAPIClientTest() {
assertResponseSuccessful(response)
with(response.body()!!.searchResult) {
artistList.size `should be equal to` 1
artistList[0] `should equal` Artist(id = "522", name = "The Prodigy")
artistList[0] `should be equal to` Artist(id = "522", name = "The Prodigy")
albumList.size `should be equal to` 1
albumList[0] `should equal` MusicDirectoryChild(
albumList[0] `should be equal to` MusicDirectoryChild(
id = "8867", parent = "522",
isDir = true, title = "Always Outnumbered, Never Outgunned",
album = "Always Outnumbered, Never Outgunned", artist = "The Prodigy",
@ -41,7 +40,7 @@ class SubsonicApiSearchTwoTest : SubsonicAPIClientTest() {
created = parseDate("2016-10-23T20:57:27.000Z")
)
songList.size `should be equal to` 1
songList[0] `should equal` MusicDirectoryChild(
songList[0] `should be equal to` MusicDirectoryChild(
id = "5831", parent = "5766",
isDir = false,
title = "You'll Be Under My Wheels", album = "Need for Speed Most Wanted",

View File

@ -3,7 +3,6 @@ package org.moire.ultrasonic.api.subsonic
import okhttp3.mockwebserver.MockResponse
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should be`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not be`
import org.junit.Test
@ -20,7 +19,7 @@ class SubsonicApiStreamTest : SubsonicAPIClientTest() {
with(response) {
stream `should be` null
responseHttpCode `should be equal to` 200
apiError `should equal` SubsonicError.RequestedDataWasNotFound
apiError `should be equal to` SubsonicError.RequestedDataWasNotFound
}
}

View File

@ -1,6 +1,6 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
@ -20,7 +20,7 @@ class SubsonicAPIVersionsTest(private val apiVersion: SubsonicAPIVersions) {
fun `Should proper convert api version to enum`() {
SubsonicAPIVersions.getClosestKnownClientApiVersion(
apiVersion.restApiVersion
) `should equal` apiVersion
) `should be equal to` apiVersion
}
@Test(expected = IllegalArgumentException::class)

View File

@ -1,7 +1,6 @@
package org.moire.ultrasonic.api.subsonic.models
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should throw`
import org.junit.Test
@ -15,7 +14,7 @@ class AlbumListTypeTest {
val albumListType = AlbumListType.fromName(type)
albumListType `should equal` AlbumListType.SORTED_BY_NAME
albumListType `should be equal to` AlbumListType.SORTED_BY_NAME
}
@Test
@ -30,7 +29,7 @@ class AlbumListTypeTest {
@Test
fun `Should convert type string to corresponding AlbumListType`() {
AlbumListType.values().forEach {
AlbumListType.fromName(it.typeName) `should equal` it
AlbumListType.fromName(it.typeName) `should be equal to` it
}
}

View File

@ -1,6 +1,6 @@
package org.moire.ultrasonic.api.subsonic.models
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
@ -19,7 +19,7 @@ class StatusTest(private val status: SubsonicResponse.Status) {
@Test
fun `Should proper parse response status`() {
SubsonicResponse.Status.getStatusFromJson(status.jsonValue) `should equal` status
SubsonicResponse.Status.getStatusFromJson(status.jsonValue) `should be equal to` status
}
@Test(expected = IllegalArgumentException::class)

View File

@ -2,10 +2,11 @@ ext.versions = [
minSdk : 14,
targetSdk : 29,
compileSdk : 29,
gradle : '6.5',
// You need to run ./gradlew wrapper after updating the version
gradle : '7.0',
navigation : "2.3.2",
gradlePlugin : "4.1.3",
gradlePlugin : "4.2.0",
androidxcore : "1.5.0-rc01",
ktlint : "0.37.1",
ktlintGradle : "9.2.1",
@ -24,19 +25,18 @@ ext.versions = [
kotlinxCoroutines : "1.3.9",
viewModelKtx : "2.2.0",
retrofit : "2.4.0",
retrofit : "2.6.4",
jackson : "2.9.5",
okhttp : "3.12.13",
semver : "1.0.0",
twitterSerial : "0.1.6",
koin : "2.2.2",
picasso : "2.71828",
junit4 : "4.12",
junit5 : "5.3.1",
junit5 : "5.7.1",
mockito : "3.8.0",
mockitoKotlin : "1.5.0",
kluent : "1.35",
kluent : "1.64",
apacheCodecs : "1.10",
testRunner : "1.0.1",
robolectric : "4.5.1",
@ -82,7 +82,6 @@ ext.other = [
jacksonConverter : "com.squareup.retrofit2:converter-jackson:$versions.retrofit",
jacksonKotlin : "com.fasterxml.jackson.module:jackson-module-kotlin:$versions.jackson",
okhttpLogging : "com.squareup.okhttp3:logging-interceptor:$versions.okhttp",
semver : "net.swiftzer.semver:semver:$versions.semver",
twitterSerial : "com.twitter.serial:serial:$versions.twitterSerial",
koinCore : "org.koin:koin-core:$versions.koin",
koinAndroid : "org.koin:koin-android:$versions.koin",

Binary file not shown.

View File

@ -1,6 +1,5 @@
#Sat Jun 13 17:12:11 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

View File

@ -6,7 +6,7 @@ jacoco {
def mergedJacocoExec = file("${project.buildDir}/jacoco/jacocoMerged.exec")
tasks.create(name: 'jacocoMergeReports', type: JacocoMerge) {
def merge = tasks.register('jacocoMergeReports', JacocoMerge) {
group = "Reporting"
description = "Merge all jacoco reports from projects into one."
@ -27,7 +27,8 @@ tasks.create(name: 'jacocoMergeReports', type: JacocoMerge) {
destinationFile(mergedJacocoExec)
}
tasks.create(name: 'jacocoFullReport', type: JacocoReport, dependsOn: 'jacocoMergeReports') {
tasks.register('jacocoFullReport', JacocoReport) {
dependsOn merge
group = "Reporting"
description = "Generate full Jacoco coverage report including all modules."
@ -46,47 +47,46 @@ tasks.create(name: 'jacocoFullReport', type: JacocoReport, dependsOn: 'jacocoMer
// Task will run anyway even if initial inputs are empty
onlyIf = { true }
doFirst {
project.subprojects { subproject ->
subproject.plugins.withId("jacoco") {
project.logger.info("${subproject.name} has Jacoco plugin applied")
subproject.plugins.withId("kotlin-android") {
project.logger.info("${subproject.name} is android project")
def mainSources = subproject.extensions.findByName("android").sourceSets['main']
project.logger.info("Android sources: ${mainSources.java.srcDirs}")
mainSources.java.srcDirs.forEach {
additionalSourceDirs(it)
}
project.logger.info("Subproject exclude: ${subproject.jacocoExclude}")
additionalClassDirs(fileTree(
dir: "${subproject.buildDir}/tmp/kotlin-classes/debug",
excludes: subproject.jacocoExclude
))
project.subprojects { subproject ->
subproject.plugins.withId("jacoco") {
project.logger.info("${subproject.name} has Jacoco plugin applied")
subproject.plugins.withId("kotlin-android") {
project.logger.info("${subproject.name} is android project")
def mainSources = subproject.extensions.findByName("android").sourceSets['main']
project.logger.info("Android sources: ${mainSources.java.srcDirs}")
mainSources.java.srcDirs.forEach {
additionalSourceDirs(it)
}
subproject.plugins.withId("kotlin") { plugin ->
project.logger.info("${subproject.name} is common kotlin project")
SourceDirectorySet mainSources = subproject.extensions.getByName("kotlin")
.sourceSets[SourceSet.MAIN_SOURCE_SET_NAME]
.kotlin
mainSources.srcDirs.forEach {
project.logger.debug("Adding sources: $it")
additionalSourceDirs(it)
}
project.logger.info("Subproject exclude: ${subproject.jacocoExclude}")
additionalClassDirs(fileTree(
dir: "${subproject.buildDir}/classes/kotlin/main",
excludes: subproject.jacocoExclude
))
project.logger.info("Subproject exclude: ${subproject.jacocoExclude}")
additionalClassDirs(fileTree(
dir: "${subproject.buildDir}/tmp/kotlin-classes/debug",
excludes: subproject.jacocoExclude
))
}
subproject.plugins.withId("kotlin") { plugin ->
project.logger.info("${subproject.name} is common kotlin project")
SourceDirectorySet mainSources = subproject.extensions.getByName("kotlin")
.sourceSets[SourceSet.MAIN_SOURCE_SET_NAME]
.kotlin
mainSources.srcDirs.forEach {
project.logger.debug("Adding sources: $it")
additionalSourceDirs(it)
}
project.logger.info("Subproject exclude: ${subproject.jacocoExclude}")
additionalClassDirs(fileTree(
dir: "${subproject.buildDir}/classes/kotlin/main",
excludes: subproject.jacocoExclude
))
}
subproject.tasks.withType(Test) { task ->
File destFile = task.extensions.getByType(JacocoTaskExtension.class).destinationFile
if (destFile.exists() && !task.name.contains("Release")) {
project.logger.info("Adding execution data: $destFile")
executionData(destFile)
}
subproject.tasks.withType(Test) { task ->
File destFile = task.extensions.getByType(JacocoTaskExtension.class).destinationFile
if (destFile.exists() && !task.name.contains("Release")) {
project.logger.info("Adding execution data: $destFile")
executionData(destFile)
}
}
}
}
}

View File

@ -10,9 +10,6 @@ sourceSets {
test.resources.srcDirs += "${projectDir}/src/integrationTest/resources"
}
test {
useJUnitPlatform()
}
dependencies {
api other.kotlinStdlib
@ -44,15 +41,17 @@ jacocoTestReport {
}
}
test.finalizedBy jacocoTestReport
test {
tasks.named("test").configure {
useJUnitPlatform()
jacoco {
excludes += jacocoExclude
includeNoLocationClasses = true
}
finalizedBy jacocoTestReport
}
tasks.create(name: "ciTest", dependsOn: "test") {
tasks.register("ciTest") {
dependsOn test
group = "Verification"
description = "Special task for CI that calls all tests in pure kotlin modules"
}

53
gradlew vendored
View File

@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@ -66,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

43
gradlew.bat vendored
View File

@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -45,28 +64,14 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell

View File

@ -320,7 +320,7 @@ class EditServerFragment : Fragment(), OnBackPressedHandler {
// Execute a ping to retrieve the API version.
// This is accepted to fail if the authentication is incorrect yet.
var pingResponse = subsonicApiClient.api.ping().execute()
if (pingResponse?.body() != null) {
if (pingResponse.body() != null) {
val restApiVersion = pingResponse.body()!!.version.restApiVersion
currentServerSetting!!.minimumApiVersion = restApiVersion
Timber.i("Server minimum API version set to %s", restApiVersion)

View File

@ -93,7 +93,6 @@ class SelectAlbumFragment : Fragment() {
private var cancellationToken: CancellationToken? = null
private val activeServerProvider: ActiveServerProvider by inject()
private val serverSettingsModel: ServerSettingsModel by viewModel()
private val model: SelectAlbumModel by viewModels()
private val random: Random = SecureRandom()
@ -133,6 +132,7 @@ class SelectAlbumFragment : Fragment() {
requireContext(), view as ViewGroup
) { selectedFolderId ->
if (!isOffline(context)) {
val serverSettingsModel: ServerSettingsModel by viewModel()
val currentSetting = activeServerProvider.getActiveServer()
currentSetting.musicFolderId = selectedFolderId
serverSettingsModel.updateItem(currentSetting)
@ -230,31 +230,32 @@ class SelectAlbumFragment : Fragment() {
}
private fun updateDisplay(refresh: Boolean) {
val id = requireArguments().getString(Constants.INTENT_EXTRA_NAME_ID)
val isAlbum = requireArguments().getBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, false)
val name = requireArguments().getString(Constants.INTENT_EXTRA_NAME_NAME)
val parentId = requireArguments().getString(Constants.INTENT_EXTRA_NAME_PARENT_ID)
val playlistId = requireArguments().getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID)
val podcastChannelId = requireArguments().getString(
val args = requireArguments()
val id = args.getString(Constants.INTENT_EXTRA_NAME_ID)
val isAlbum = args.getBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, false)
val name = args.getString(Constants.INTENT_EXTRA_NAME_NAME)
val parentId = args.getString(Constants.INTENT_EXTRA_NAME_PARENT_ID)
val playlistId = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID)
val podcastChannelId = args.getString(
Constants.INTENT_EXTRA_NAME_PODCAST_CHANNEL_ID
)
val playlistName = requireArguments().getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME)
val shareId = requireArguments().getString(Constants.INTENT_EXTRA_NAME_SHARE_ID)
val shareName = requireArguments().getString(Constants.INTENT_EXTRA_NAME_SHARE_NAME)
val albumListType = requireArguments().getString(
val playlistName = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME)
val shareId = args.getString(Constants.INTENT_EXTRA_NAME_SHARE_ID)
val shareName = args.getString(Constants.INTENT_EXTRA_NAME_SHARE_NAME)
val albumListType = args.getString(
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE
)
val genreName = requireArguments().getString(Constants.INTENT_EXTRA_NAME_GENRE_NAME)
val albumListTitle = requireArguments().getInt(
val genreName = args.getString(Constants.INTENT_EXTRA_NAME_GENRE_NAME)
val albumListTitle = args.getInt(
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TITLE, 0
)
val getStarredTracks = requireArguments().getInt(Constants.INTENT_EXTRA_NAME_STARRED, 0)
val getVideos = requireArguments().getInt(Constants.INTENT_EXTRA_NAME_VIDEOS, 0)
val getRandomTracks = requireArguments().getInt(Constants.INTENT_EXTRA_NAME_RANDOM, 0)
val albumListSize = requireArguments().getInt(
val getStarredTracks = args.getInt(Constants.INTENT_EXTRA_NAME_STARRED, 0)
val getVideos = args.getInt(Constants.INTENT_EXTRA_NAME_VIDEOS, 0)
val getRandomTracks = args.getInt(Constants.INTENT_EXTRA_NAME_RANDOM, 0)
val albumListSize = args.getInt(
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 0
)
val albumListOffset = requireArguments().getInt(
val albumListOffset = args.getInt(
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0
)

View File

@ -54,50 +54,49 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
parentId: String?
) {
withContext(Dispatchers.IO) {
if (!ActiveServerProvider.isOffline(context)) {
val service = MusicServiceFactory.getMusicService(context)
var root = MusicDirectory()
val service = MusicServiceFactory.getMusicService(context)
if (allSongsId == id) {
val musicDirectory = service.getMusicDirectory(
parentId, name, refresh, context
)
var root = MusicDirectory()
val songs: MutableList<MusicDirectory.Entry> = LinkedList()
getSongsRecursively(musicDirectory, songs)
if (allSongsId == id) {
val musicDirectory = service.getMusicDirectory(
parentId, name, refresh, context
)
for (song in songs) {
if (!song.isDirectory) {
root.addChild(song)
}
}
} else {
val musicDirectory = service.getMusicDirectory(id, name, refresh, context)
val songs: MutableList<MusicDirectory.Entry> = LinkedList()
getSongsRecursively(musicDirectory, songs)
if (Util.getShouldShowAllSongsByArtist(context) &&
musicDirectory.findChild(allSongsId) == null &&
hasOnlyFolders(musicDirectory)
) {
val allSongs = MusicDirectory.Entry()
allSongs.isDirectory = true
allSongs.artist = name
allSongs.parent = id
allSongs.id = allSongsId
allSongs.title = String.format(
context.resources.getString(R.string.select_album_all_songs), name
)
root.addChild(allSongs)
root.addAll(musicDirectory.getChildren())
} else {
root = musicDirectory
for (song in songs) {
if (!song.isDirectory) {
root.addChild(song)
}
}
} else {
val musicDirectory = service.getMusicDirectory(id, name, refresh, context)
currentDirectory.postValue(root)
if (Util.getShouldShowAllSongsByArtist(context) &&
musicDirectory.findChild(allSongsId) == null &&
hasOnlyFolders(musicDirectory)
) {
val allSongs = MusicDirectory.Entry()
allSongs.isDirectory = true
allSongs.artist = name
allSongs.parent = id
allSongs.id = allSongsId
allSongs.title = String.format(
context.resources.getString(R.string.select_album_all_songs), name
)
root.addChild(allSongs)
root.addAll(musicDirectory.getChildren())
} else {
root = musicDirectory
}
}
currentDirectory.postValue(root)
}
}
@ -128,107 +127,99 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
suspend fun getArtist(refresh: Boolean, id: String?, name: String?) {
withContext(Dispatchers.IO) {
if (!ActiveServerProvider.isOffline(context)) {
val service = MusicServiceFactory.getMusicService(context)
val service = MusicServiceFactory.getMusicService(context)
var root = MusicDirectory()
var root = MusicDirectory()
val musicDirectory = service.getArtist(id, name, refresh, context)
val musicDirectory = service.getArtist(id, name, refresh, context)
if (Util.getShouldShowAllSongsByArtist(context) &&
musicDirectory.findChild(allSongsId) == null &&
hasOnlyFolders(musicDirectory)
) {
val allSongs = MusicDirectory.Entry()
if (Util.getShouldShowAllSongsByArtist(context) &&
musicDirectory.findChild(allSongsId) == null &&
hasOnlyFolders(musicDirectory)
) {
val allSongs = MusicDirectory.Entry()
allSongs.isDirectory = true
allSongs.artist = name
allSongs.parent = id
allSongs.id = allSongsId
allSongs.title = String.format(
context.resources.getString(R.string.select_album_all_songs), name
)
allSongs.isDirectory = true
allSongs.artist = name
allSongs.parent = id
allSongs.id = allSongsId
allSongs.title = String.format(
context.resources.getString(R.string.select_album_all_songs), name
)
root.addFirst(allSongs)
root.addAll(musicDirectory.getChildren())
} else {
root = musicDirectory
}
currentDirectory.postValue(root)
root.addFirst(allSongs)
root.addAll(musicDirectory.getChildren())
} else {
root = musicDirectory
}
currentDirectory.postValue(root)
}
}
suspend fun getAlbum(refresh: Boolean, id: String?, name: String?, parentId: String?) {
withContext(Dispatchers.IO) {
if (!ActiveServerProvider.isOffline(context)) {
val service = MusicServiceFactory.getMusicService(context)
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory: MusicDirectory
val musicDirectory: MusicDirectory
musicDirectory = if (allSongsId == id) {
val root = MusicDirectory()
musicDirectory = if (allSongsId == id) {
val root = MusicDirectory()
val songs: MutableCollection<MusicDirectory.Entry> = LinkedList()
val artist = service.getArtist(parentId, "", false, context)
val songs: MutableCollection<MusicDirectory.Entry> = LinkedList()
val artist = service.getArtist(parentId, "", false, context)
for ((id1) in artist.getChildren()) {
if (allSongsId != id1) {
val albumDirectory = service.getAlbum(
id1, "", false, context
)
for ((id1) in artist.getChildren()) {
if (allSongsId != id1) {
val albumDirectory = service.getAlbum(
id1, "", false, context
)
for (song in albumDirectory.getChildren()) {
if (!song.isVideo) {
songs.add(song)
}
for (song in albumDirectory.getChildren()) {
if (!song.isVideo) {
songs.add(song)
}
}
}
for (song in songs) {
if (!song.isDirectory) {
root.addChild(song)
}
}
root
} else {
service.getAlbum(id, name, refresh, context)
}
currentDirectory.postValue(musicDirectory)
for (song in songs) {
if (!song.isDirectory) {
root.addChild(song)
}
}
root
} else {
service.getAlbum(id, name, refresh, context)
}
currentDirectory.postValue(musicDirectory)
}
}
suspend fun getSongsForGenre(genre: String, count: Int, offset: Int) {
withContext(Dispatchers.IO) {
if (!ActiveServerProvider.isOffline(context)) {
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory = service.getSongsByGenre(genre, count, offset, context)
songsForGenre.postValue(musicDirectory)
}
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory = service.getSongsByGenre(genre, count, offset, context)
songsForGenre.postValue(musicDirectory)
}
}
suspend fun getStarred() {
withContext(Dispatchers.IO) {
if (!ActiveServerProvider.isOffline(context)) {
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory: MusicDirectory
val context = context
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory: MusicDirectory
val context = context
if (Util.getShouldUseId3Tags(context)) {
musicDirectory = Util.getSongsFromSearchResult(service.getStarred2(context))
} else {
musicDirectory = Util.getSongsFromSearchResult(service.getStarred(context))
}
currentDirectory.postValue(musicDirectory)
if (Util.getShouldUseId3Tags(context)) {
musicDirectory = Util.getSongsFromSearchResult(service.getStarred2(context))
} else {
musicDirectory = Util.getSongsFromSearchResult(service.getStarred(context))
}
currentDirectory.postValue(musicDirectory)
}
}
@ -236,68 +227,58 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
showHeader = false
withContext(Dispatchers.IO) {
if (!ActiveServerProvider.isOffline(context)) {
val service = MusicServiceFactory.getMusicService(context)
currentDirectory.postValue(service.getVideos(refresh, context))
}
val service = MusicServiceFactory.getMusicService(context)
currentDirectory.postValue(service.getVideos(refresh, context))
}
}
suspend fun getRandom(size: Int) {
withContext(Dispatchers.IO) {
if (!ActiveServerProvider.isOffline(context)) {
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory = service.getRandomSongs(size, context)
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory = service.getRandomSongs(size, context)
currentDirectoryIsSortable = false
currentDirectory.postValue(musicDirectory)
}
currentDirectoryIsSortable = false
currentDirectory.postValue(musicDirectory)
}
}
suspend fun getPlaylist(playlistId: String, playlistName: String?) {
withContext(Dispatchers.IO) {
if (!ActiveServerProvider.isOffline(context)) {
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory = service.getPlaylist(playlistId, playlistName, context)
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory = service.getPlaylist(playlistId, playlistName, context)
currentDirectory.postValue(musicDirectory)
}
currentDirectory.postValue(musicDirectory)
}
}
suspend fun getPodcastEpisodes(podcastChannelId: String) {
withContext(Dispatchers.IO) {
if (!ActiveServerProvider.isOffline(context)) {
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory = service.getPodcastEpisodes(podcastChannelId, context)
currentDirectory.postValue(musicDirectory)
}
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory = service.getPodcastEpisodes(podcastChannelId, context)
currentDirectory.postValue(musicDirectory)
}
}
suspend fun getShare(shareId: String) {
withContext(Dispatchers.IO) {
if (!ActiveServerProvider.isOffline(context)) {
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory = MusicDirectory()
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory = MusicDirectory()
val shares = service.getShares(true, context)
val shares = service.getShares(true, context)
for (share in shares) {
if (share.id == shareId) {
for (entry in share.getEntries()) {
musicDirectory.addChild(entry)
}
break
for (share in shares) {
if (share.id == shareId) {
for (entry in share.getEntries()) {
musicDirectory.addChild(entry)
}
break
}
currentDirectory.postValue(musicDirectory)
}
currentDirectory.postValue(musicDirectory)
}
}
@ -311,30 +292,28 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
)
withContext(Dispatchers.IO) {
if (!ActiveServerProvider.isOffline(context)) {
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory: MusicDirectory
val musicFolderId = if (showSelectFolderHeader) {
activeServerProvider.getActiveServer().musicFolderId
} else {
null
}
if (Util.getShouldUseId3Tags(context)) {
musicDirectory = service.getAlbumList2(
albumListType, size,
offset, musicFolderId, context
)
} else {
musicDirectory = service.getAlbumList(
albumListType, size,
offset, musicFolderId, context
)
}
currentDirectoryIsSortable = sortableCollection(albumListType)
albumList.postValue(musicDirectory)
val service = MusicServiceFactory.getMusicService(context)
val musicDirectory: MusicDirectory
val musicFolderId = if (showSelectFolderHeader) {
activeServerProvider.getActiveServer().musicFolderId
} else {
null
}
if (Util.getShouldUseId3Tags(context)) {
musicDirectory = service.getAlbumList2(
albumListType, size,
offset, musicFolderId, context
)
} else {
musicDirectory = service.getAlbumList(
albumListType, size,
offset, musicFolderId, context
)
}
currentDirectoryIsSortable = sortableCollection(albumListType)
albumList.postValue(musicDirectory)
}
}

View File

@ -26,7 +26,7 @@ class ApiCallResponseChecker(
if (activeServerProvider.getActiveServer().minimumApiVersion == null) {
try {
val response = subsonicAPIClient.api.ping().execute()
if (response?.body() != null) {
if (response.body() != null) {
val restApiVersion = response.body()!!.version.restApiVersion
Timber.i("Server minimum API version set to %s", restApiVersion)
activeServerProvider.setMinimumApiVersion(restApiVersion)

View File

@ -4,7 +4,6 @@ package org.moire.ultrasonic.domain
import java.util.Calendar
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Album
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
@ -24,17 +23,17 @@ class APIAlbumConverterTest {
val convertedEntity = entity.toDomainEntity()
with(convertedEntity) {
id `should equal` entity.id
title `should equal` entity.name
isDirectory `should equal` true
coverArt `should equal` entity.coverArt
artist `should equal` entity.artist
artistId `should equal` entity.artistId
songCount `should equal` entity.songCount.toLong()
duration `should equal` entity.duration
created `should equal` entity.created?.time
year `should equal` entity.year
genre `should equal` entity.genre
id `should be equal to` entity.id
title `should be equal to` entity.name
isDirectory `should be equal to` true
coverArt `should be equal to` entity.coverArt
artist `should be equal to` entity.artist
artistId `should be equal to` entity.artistId
songCount `should be equal to` entity.songCount.toLong()
duration `should be equal to` entity.duration
created `should be equal to` entity.created?.time
year `should be equal to` entity.year
genre `should be equal to` entity.genre
}
}
@ -50,9 +49,9 @@ class APIAlbumConverterTest {
val convertedEntity = entity.toMusicDirectoryDomainEntity()
with(convertedEntity) {
name `should equal` null
name `should be equal to` null
getChildren().size `should be equal to` entity.songList.size
getChildren()[0] `should equal` entity.songList[0].toDomainEntity()
getChildren()[0] `should be equal to` entity.songList[0].toDomainEntity()
}
}
@ -65,7 +64,7 @@ class APIAlbumConverterTest {
with(convertedList) {
size `should be equal to` entityList.size
forEachIndexed { index, entry ->
entry `should equal` entityList[index].toDomainEntity()
entry `should be equal to` entityList[index].toDomainEntity()
}
}
}

View File

@ -3,7 +3,7 @@
package org.moire.ultrasonic.domain
import java.util.Calendar
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Album
import org.moire.ultrasonic.api.subsonic.models.Artist
@ -19,8 +19,8 @@ class APIArtistConverterTest {
val convertedEntity = entity.toDomainEntity()
with(convertedEntity) {
id `should equal` entity.id
name `should equal` entity.name
id `should be equal to` entity.id
name `should be equal to` entity.name
}
}
@ -41,8 +41,8 @@ class APIArtistConverterTest {
val convertedEntity = entity.toMusicDirectoryDomainEntity()
with(convertedEntity) {
name `should equal` entity.name
getAllChild() `should equal` entity.albumsList
name `should be equal to` entity.name
getAllChild() `should be equal to` entity.albumsList
.map { it.toDomainEntity() }.toMutableList()
}
}

View File

@ -4,7 +4,6 @@ package org.moire.ultrasonic.domain
import java.util.Calendar
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Bookmark
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
@ -24,11 +23,11 @@ class APIBookmarkConverterTest {
with(domainEntity) {
position `should be equal to` entity.position.toInt()
username `should equal` entity.username
comment `should equal` entity.comment
created `should equal` entity.created?.time
changed `should equal` entity.changed?.time
entry `should equal` entity.entry.toDomainEntity()
username `should be equal to` entity.username
comment `should be equal to` entity.comment
created `should be equal to` entity.created?.time
changed `should be equal to` entity.changed?.time
entry `should be equal to` entity.entry.toDomainEntity()
}
}
@ -40,7 +39,7 @@ class APIBookmarkConverterTest {
domainEntitiesList.size `should be equal to` entitiesList.size
domainEntitiesList.forEachIndexed({ index, bookmark ->
bookmark `should equal` entitiesList[index].toDomainEntity()
bookmark `should be equal to` entitiesList[index].toDomainEntity()
})
}
}

View File

@ -3,7 +3,6 @@
package org.moire.ultrasonic.domain
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.ChatMessage
@ -18,9 +17,9 @@ class APIChatMessageConverterTest {
val domainEntity = entity.toDomainEntity()
with(domainEntity) {
username `should equal` entity.username
time `should equal` entity.time
message `should equal` entity.message
username `should be equal to` entity.username
time `should be equal to` entity.time
message `should be equal to` entity.message
}
}
@ -33,7 +32,7 @@ class APIChatMessageConverterTest {
with(domainEntitiesList) {
size `should be equal to` entitiesList.size
forEachIndexed { index, chatMessage ->
chatMessage `should equal` entitiesList[index].toDomainEntity()
chatMessage `should be equal to` entitiesList[index].toDomainEntity()
}
}
}

View File

@ -3,7 +3,6 @@
package org.moire.ultrasonic.domain
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Artist
import org.moire.ultrasonic.api.subsonic.models.Index
@ -39,8 +38,8 @@ class APIIndexesConverterTest {
lastModified `should be equal to` entity.lastModified
ignoredArticles `should be equal to` entity.ignoredArticles
artists.size `should be equal to` expectedArtists.size
artists `should equal` expectedArtists
shortcuts `should equal` artistsA.map { it.toDomainEntity() }.toMutableList()
artists `should be equal to` expectedArtists
shortcuts `should be equal to` artistsA.map { it.toDomainEntity() }.toMutableList()
}
}
}

View File

@ -3,7 +3,6 @@
package org.moire.ultrasonic.domain
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.JukeboxStatus
@ -18,10 +17,10 @@ class APIJukeboxConverterTest {
val convertedEntity = entity.toDomainEntity()
with(convertedEntity) {
currentPlayingIndex `should equal` entity.currentIndex
gain `should equal` entity.gain
currentPlayingIndex `should be equal to` entity.currentIndex
gain `should be equal to` entity.gain
isPlaying `should be equal to` entity.playing
positionSeconds `should equal` entity.position
positionSeconds `should be equal to` entity.position
}
}
}

View File

@ -2,7 +2,7 @@
package org.moire.ultrasonic.domain
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should be equal to`
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` entity.artist
title `should equal` entity.title
text `should equal` entity.text
artist `should be equal to` entity.artist
title `should be equal to` entity.title
text `should be equal to` entity.text
}
}
}

View File

@ -4,7 +4,6 @@ package org.moire.ultrasonic.domain
import java.util.Calendar
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectory
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
@ -24,9 +23,9 @@ class APIMusicDirectoryConverterTest {
val convertedEntity = entity.toDomainEntity()
with(convertedEntity) {
name `should equal` entity.name
name `should be equal to` entity.name
getAllChild().size `should be equal to` entity.childList.size
getAllChild() `should equal` entity.childList
getAllChild() `should be equal to` entity.childList
.map { it.toDomainEntity() }.toMutableList()
}
}
@ -48,33 +47,33 @@ class APIMusicDirectoryConverterTest {
val convertedEntity = entity.toDomainEntity()
with(convertedEntity) {
id `should equal` entity.id
parent `should equal` entity.parent
id `should be equal to` entity.id
parent `should be equal to` entity.parent
isDirectory `should be equal to` entity.isDir
title `should equal` entity.title
album `should equal` entity.album
albumId `should equal` entity.albumId
artist `should equal` entity.artist
artistId `should equal` entity.artistId
track `should equal` entity.track
year `should equal` entity.year!!
genre `should equal` entity.genre
contentType `should equal` entity.contentType
suffix `should equal` entity.suffix
transcodedContentType `should equal` entity.transcodedContentType
transcodedSuffix `should equal` entity.transcodedSuffix
coverArt `should equal` entity.coverArt
size `should equal` entity.size
duration `should equal` entity.duration
bitRate `should equal` entity.bitRate
path `should equal` entity.path
title `should be equal to` entity.title
album `should be equal to` entity.album
albumId `should be equal to` entity.albumId
artist `should be equal to` entity.artist
artistId `should be equal to` entity.artistId
track `should be equal to` entity.track
year `should be equal to` entity.year!!
genre `should be equal to` entity.genre
contentType `should be equal to` entity.contentType
suffix `should be equal to` entity.suffix
transcodedContentType `should be equal to` entity.transcodedContentType
transcodedSuffix `should be equal to` entity.transcodedSuffix
coverArt `should be equal to` entity.coverArt
size `should be equal to` entity.size
duration `should be equal to` entity.duration
bitRate `should be equal to` entity.bitRate
path `should be equal to` entity.path
isVideo `should be equal to` entity.isVideo
created `should equal` entity.created?.time
created `should be equal to` entity.created?.time
starred `should be equal to` (entity.starred != null)
discNumber `should equal` entity.discNumber
type `should equal` entity.type
userRating `should equal` entity.userRating
averageRating `should equal` entity.averageRating
discNumber `should be equal to` entity.discNumber
type `should be equal to` entity.type
userRating `should be equal to` entity.userRating
averageRating `should be equal to` entity.averageRating
}
}
@ -88,8 +87,8 @@ class APIMusicDirectoryConverterTest {
val convertedEntity = entity.toDomainEntity()
with(convertedEntity) {
id `should equal` entity.streamId
artist `should equal` dateFormat.format(entity.publishDate?.time)
id `should be equal to` entity.streamId
artist `should be equal to` dateFormat.format(entity.publishDate!!.time)
}
}
@ -101,7 +100,7 @@ class APIMusicDirectoryConverterTest {
domainList.size `should be equal to` entitiesList.size
domainList.forEachIndexed { index, entry ->
entry `should equal` entitiesList[index].toDomainEntity()
entry `should be equal to` entitiesList[index].toDomainEntity()
}
}
}

View File

@ -4,7 +4,6 @@ package org.moire.ultrasonic.domain
import java.util.Calendar
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
import org.moire.ultrasonic.api.subsonic.models.Playlist
@ -26,10 +25,10 @@ class APIPlaylistConverterTest {
val convertedEntity = entity.toMusicDirectoryDomainEntity()
with(convertedEntity) {
name `should equal` entity.name
name `should be equal to` entity.name
getAllChild().size `should be equal to` entity.entriesList.size
getAllChild()[0] `should equal` entity.entriesList[0].toDomainEntity()
getAllChild()[1] `should equal` entity.entriesList[1].toDomainEntity()
getAllChild()[0] `should be equal to` entity.entriesList[0].toDomainEntity()
getAllChild()[1] `should be equal to` entity.entriesList[1].toDomainEntity()
}
}
@ -49,9 +48,9 @@ class APIPlaylistConverterTest {
name `should be equal to` entity.name
comment `should be equal to` entity.comment
owner `should be equal to` entity.owner
public `should equal` entity.public
public `should be equal to` entity.public
songCount `should be equal to` entity.songCount.toString()
created `should be equal to` playlistDateFormat.format(entity.created?.time)
created `should be equal to` playlistDateFormat.format(entity.created!!.time)
}
}
@ -63,7 +62,7 @@ class APIPlaylistConverterTest {
with(convertedList) {
size `should be equal to` entitiesList.size
this[0] `should equal` entitiesList[0].toDomainEntity()
this[0] `should be equal to` entitiesList[0].toDomainEntity()
}
}
}

View File

@ -3,7 +3,6 @@
package org.moire.ultrasonic.domain
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.PodcastChannel
@ -22,11 +21,11 @@ class APIPodcastConverterTest {
val converterEntity = entity.toDomainEntity()
with(converterEntity) {
id `should equal` entity.id
description `should equal` entity.description
status `should equal` entity.status
title `should equal` entity.title
url `should equal` entity.url
id `should be equal to` entity.id
description `should be equal to` entity.description
status `should be equal to` entity.status
title `should be equal to` entity.title
url `should be equal to` entity.url
}
}
@ -41,7 +40,7 @@ class APIPodcastConverterTest {
with(converted) {
size `should be equal to` entitiesList.size
this[0] `should equal` entitiesList[0].toDomainEntity()
this[0] `should be equal to` entitiesList[0].toDomainEntity()
}
}
}

View File

@ -3,8 +3,7 @@
package org.moire.ultrasonic.domain
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.amshove.kluent.`should not equal`
import org.amshove.kluent.`should not be equal to`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Album
import org.moire.ultrasonic.api.subsonic.models.Artist
@ -30,12 +29,12 @@ class APISearchConverterTest {
val convertedEntity = entity.toDomainEntity()
with(convertedEntity) {
albums `should not equal` null
albums `should not be equal to` null
albums.size `should be equal to` 0
artists `should not equal` null
artists `should not be equal to` null
artists.size `should be equal to` 0
songs.size `should be equal to` entity.matchList.size
songs[0] `should equal` entity.matchList[0].toDomainEntity()
songs[0] `should be equal to` entity.matchList[0].toDomainEntity()
}
}
@ -51,11 +50,11 @@ class APISearchConverterTest {
with(convertedEntity) {
artists.size `should be equal to` entity.artistList.size
artists[0] `should equal` entity.artistList[0].toDomainEntity()
artists[0] `should be equal to` entity.artistList[0].toDomainEntity()
albums.size `should be equal to` entity.albumList.size
albums[0] `should equal` entity.albumList[0].toDomainEntity()
albums[0] `should be equal to` entity.albumList[0].toDomainEntity()
songs.size `should be equal to` entity.songList.size
songs[0] `should equal` entity.songList[0].toDomainEntity()
songs[0] `should be equal to` entity.songList[0].toDomainEntity()
}
}
@ -71,11 +70,11 @@ class APISearchConverterTest {
with(convertedEntity) {
artists.size `should be equal to` entity.artistList.size
artists[0] `should equal` entity.artistList[0].toDomainEntity()
artists[0] `should be equal to` entity.artistList[0].toDomainEntity()
albums.size `should be equal to` entity.albumList.size
albums[0] `should equal` entity.albumList[0].toDomainEntity()
albums[0] `should be equal to` entity.albumList[0].toDomainEntity()
songs.size `should be equal to` entity.songList.size
songs[0] `should equal` entity.songList[0].toDomainEntity()
songs[0] `should be equal to` entity.songList[0].toDomainEntity()
}
}
}

View File

@ -4,7 +4,6 @@ package org.moire.ultrasonic.domain
import java.util.Calendar
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
import org.moire.ultrasonic.api.subsonic.models.Share
@ -20,15 +19,15 @@ class APIShareConverterTest {
val domainEntity = entity.toDomainEntity()
with(domainEntity) {
id `should equal` entity.id
url `should equal` entity.url
description `should equal` entity.description
username `should equal` entity.username
created `should equal` shareTimeFormat.format(entity.created?.time)
lastVisited `should equal` shareTimeFormat.format(entity.lastVisited?.time)
expires `should equal` shareTimeFormat.format(entity.expires?.time)
visitCount `should equal` entity.visitCount.toLong()
this.getEntries() `should equal` entity.items.toDomainEntityList()
id `should be equal to` entity.id
url `should be equal to` entity.url
description `should be equal to` entity.description
username `should be equal to` entity.username
created `should be equal to` shareTimeFormat.format(entity.created!!.time)
lastVisited `should be equal to` shareTimeFormat.format(entity.lastVisited!!.time)
expires `should be equal to` shareTimeFormat.format(entity.expires!!.time)
visitCount `should be equal to` entity.visitCount.toLong()
this.getEntries() `should be equal to` entity.items.toDomainEntityList()
}
}
@ -51,7 +50,7 @@ class APIShareConverterTest {
val domainEntityList = entityList.toDomainEntitiesList()
domainEntityList.size `should be equal to` entityList.size
domainEntityList[0] `should equal` entityList[0].toDomainEntity()
domainEntityList[1] `should equal` entityList[1].toDomainEntity()
domainEntityList[0] `should be equal to` entityList[0].toDomainEntity()
domainEntityList[1] `should be equal to` entityList[1].toDomainEntity()
}
}

View File

@ -3,7 +3,6 @@
package org.moire.ultrasonic.domain
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.User
@ -25,7 +24,7 @@ class APIUserConverterTest {
commentRole `should be equal to` entity.commentRole
coverArtRole `should be equal to` entity.coverArtRole
downloadRole `should be equal to` entity.downloadRole
email `should equal` entity.email
email `should be equal to` entity.email
jukeboxRole `should be equal to` entity.jukeboxRole
playlistRole `should be equal to` entity.playlistRole
podcastRole `should be equal to` entity.podcastRole
@ -34,7 +33,7 @@ class APIUserConverterTest {
shareRole `should be equal to` entity.shareRole
streamRole `should be equal to` entity.streamRole
uploadRole `should be equal to` entity.uploadRole
userName `should equal` entity.username
userName `should be equal to` entity.username
}
}
}

View File

@ -3,7 +3,6 @@
package org.moire.ultrasonic.domain
import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should equal`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.Genre
@ -18,8 +17,8 @@ class ApiGenreConverterTest {
val domainEntity = entity.toDomainEntity()
with(domainEntity) {
name `should equal` entity.name
index `should equal` "s"
name `should be equal to` entity.name
index `should be equal to` "s"
}
}
@ -33,7 +32,7 @@ class ApiGenreConverterTest {
val domainEntitiesList = entitiesList.toDomainEntityList()
domainEntitiesList.size `should be equal to` entitiesList.size
domainEntitiesList[0] `should equal` entitiesList[0].toDomainEntity()
domainEntitiesList[1] `should equal` entitiesList[1].toDomainEntity()
domainEntitiesList[0] `should be equal to` entitiesList[0].toDomainEntity()
domainEntitiesList[1] `should be equal to` entitiesList[1].toDomainEntity()
}
}