From d6b9711e454f7f1725feb6e764c56327d1da8e06 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 15 Apr 2023 09:54:06 -0400 Subject: [PATCH] Use Kotest matchers in other test classes --- .../chapter/service/ChapterRecognitionTest.kt | 5 ++-- .../domain/library/model/LibraryFlagsTest.kt | 27 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/domain/src/test/java/tachiyomi/domain/chapter/service/ChapterRecognitionTest.kt b/domain/src/test/java/tachiyomi/domain/chapter/service/ChapterRecognitionTest.kt index 940d8b1de..c86c258e4 100644 --- a/domain/src/test/java/tachiyomi/domain/chapter/service/ChapterRecognitionTest.kt +++ b/domain/src/test/java/tachiyomi/domain/chapter/service/ChapterRecognitionTest.kt @@ -1,6 +1,6 @@ package tachiyomi.domain.chapter.service -import org.junit.jupiter.api.Assertions.assertEquals +import io.kotest.matchers.shouldBe import org.junit.jupiter.api.Test import org.junit.jupiter.api.parallel.Execution import org.junit.jupiter.api.parallel.ExecutionMode @@ -261,7 +261,6 @@ class ChapterRecognitionTest { } private fun assertChapter(mangaTitle: String, name: String, expected: Float) { - val chapterNumber = ChapterRecognition.parseChapterNumber(mangaTitle, name) - assertEquals(chapterNumber, expected) + ChapterRecognition.parseChapterNumber(mangaTitle, name) shouldBe expected } } diff --git a/domain/src/test/java/tachiyomi/domain/library/model/LibraryFlagsTest.kt b/domain/src/test/java/tachiyomi/domain/library/model/LibraryFlagsTest.kt index badbee8e6..523a50634 100644 --- a/domain/src/test/java/tachiyomi/domain/library/model/LibraryFlagsTest.kt +++ b/domain/src/test/java/tachiyomi/domain/library/model/LibraryFlagsTest.kt @@ -1,16 +1,19 @@ package tachiyomi.domain.library.model -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Assertions.assertNotEquals +import io.kotest.matchers.shouldBe +import io.kotest.matchers.shouldNotBe import org.junit.jupiter.api.Test +import org.junit.jupiter.api.parallel.Execution +import org.junit.jupiter.api.parallel.ExecutionMode +@Execution(ExecutionMode.CONCURRENT) class LibraryFlagsTest { @Test fun `Check the amount of flags`() { - assertEquals(4, LibraryDisplayMode.values.size) - assertEquals(8, LibrarySort.types.size) - assertEquals(2, LibrarySort.directions.size) + LibraryDisplayMode.values.size shouldBe 4 + LibrarySort.types.size shouldBe 8 + LibrarySort.directions.size shouldBe 2 } @Test @@ -19,7 +22,7 @@ class LibraryFlagsTest { val new = LibraryDisplayMode.CoverOnlyGrid val flag = current + new - assertEquals(0b00000011, flag) + flag shouldBe 0b00000011 } @Test @@ -28,7 +31,7 @@ class LibraryFlagsTest { val new = LibrarySort(LibrarySort.Type.DateAdded, LibrarySort.Direction.Ascending) val flag = current + new - assertEquals(0b01011100, flag) + flag shouldBe 0b01011100 } @Test @@ -37,7 +40,7 @@ class LibraryFlagsTest { val sort = LibrarySort(LibrarySort.Type.DateAdded, LibrarySort.Direction.Ascending) val flag = display + sort - assertEquals(0b01011111, flag) + flag shouldBe 0b01011111 } @Test @@ -50,9 +53,9 @@ class LibraryFlagsTest { val sort = LibrarySort(LibrarySort.Type.DateAdded, LibrarySort.Direction.Ascending) val flag = currentFlag + display + sort - assertEquals(0b00001110, currentFlag) - assertEquals(0b01011111, flag) - assertNotEquals(currentFlag, flag) + currentFlag shouldBe 0b00001110 + flag shouldBe 0b01011111 + flag shouldNotBe currentFlag } @Test @@ -61,6 +64,6 @@ class LibraryFlagsTest { val display = LibraryDisplayMode.default val flag = display + sort.type + sort.direction - assertEquals(0b01000000, flag) + flag shouldBe 0b01000000 } }