Skip to content

Commit

Permalink
test(model): Simplify several assertions via shouldContainExactly()
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
  • Loading branch information
fviernau committed Apr 23, 2024
1 parent c544784 commit 62cf9cf
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions model/src/test/kotlin/OrtResultTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import io.kotest.matchers.collections.containExactly
import io.kotest.matchers.collections.containExactlyInAnyOrder
import io.kotest.matchers.collections.haveSize
import io.kotest.matchers.collections.shouldContainExactly
import io.kotest.matchers.collections.shouldHaveSingleElement
import io.kotest.matchers.should
import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldMatch
Expand Down Expand Up @@ -173,10 +174,7 @@ class OrtResultTest : WordSpec({

val openIssues = ortResult.getOpenIssues(Severity.WARNING)

openIssues should haveSize(1)
with(openIssues.first()) {
message shouldBe "Non-resolved issue"
}
openIssues.map { it.message } shouldHaveSingleElement "Non-resolved issue"
}

"omit issues with violation below threshold" {
Expand Down Expand Up @@ -206,10 +204,7 @@ class OrtResultTest : WordSpec({

val openIssues = ortResult.getOpenIssues(Severity.WARNING)

openIssues should haveSize(1)
with(openIssues.first()) {
message shouldBe "Issue with severity 'warning'"
}
openIssues.map { it.message } shouldHaveSingleElement "Issue with severity 'warning'"
}

"omit excluded issues" {
Expand Down Expand Up @@ -248,10 +243,7 @@ class OrtResultTest : WordSpec({

val openIssues = ortResult.getOpenIssues()

openIssues should haveSize(1)
with(openIssues.first()) {
message shouldBe "Included issue"
}
openIssues.map { it.message } shouldHaveSingleElement "Included issue"
}
}

Expand Down

0 comments on commit 62cf9cf

Please sign in to comment.