X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FSoneTest.kt;h=1429e544e20bee2fe7e14175b4931401efe215f6;hp=6b7e51d5b9dc587c60bf1324c11bdb060bb3f792;hb=07d3fa7dac96e8a5eff41487d647974df8c26f8d;hpb=141f56a62e39c13b1eb14fe6e5c3b8b7bc062168 diff --git a/src/test/kotlin/net/pterodactylus/sone/data/SoneTest.kt b/src/test/kotlin/net/pterodactylus/sone/data/SoneTest.kt index 6b7e51d..1429e54 100644 --- a/src/test/kotlin/net/pterodactylus/sone/data/SoneTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/data/SoneTest.kt @@ -120,4 +120,26 @@ class SoneTest { assertThat(postCountComparator.compare(sone1, sone2), equalTo(0)) } + @Test + fun `image count comparator sorts Sones correctly if number of images is different`() { + val sone1 = object : IdOnlySone("1") { + override fun getRootAlbum() = AlbumImpl(this).also { it.addImage(createImage(this)) } + } + val sone2 = object : IdOnlySone("2") { + override fun getRootAlbum() = AlbumImpl(this).also { it.addImage(createImage(this)); it.addImage(createImage(this)) } + } + assertThat(imageCountComparator.compare(sone1, sone2), greaterThan(0)) + } + + @Test + fun `image count comparator treats Sones as equal if number of images is the same`() { + val sone1 = object : IdOnlySone("1") { + override fun getRootAlbum() = AlbumImpl(this).also { it.addImage(createImage(this)) } + } + val sone2 = object : IdOnlySone("2") { + override fun getRootAlbum() = AlbumImpl(this).also { it.addImage(createImage(this)) } + } + assertThat(imageCountComparator.compare(sone1, sone2), equalTo(0)) + } + }