Skip to content

Commit 9454e9c

Browse files
committed
[mockk-matching-varargs] add no-element cases
1 parent f1d0f68 commit 9454e9c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

kotlin-testing-2/src/test/kotlin/com/baeldung/mockk/MatchVarargsUnitTest.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ class MatchVarargsUnitTest {
4747
}.also { exception ->
4848
assertTrue(exception.message!!.startsWith("no answer found"))
4949
}
50+
51+
val result2 = mockkObj.joinBySpace("a", "b", "c", "z")
52+
assertEquals("Wow, Kotlin rocks!", result2)
5053
}
5154

5255
@Test
@@ -58,6 +61,13 @@ class MatchVarargsUnitTest {
5861

5962
val result2 = mockkObj.joinBySpace("a", "b", "c", "d1", "Baeldung", "z")
6063
assertEquals("Wow, Kotlin rocks!", result2)
64+
65+
assertThrows<MockKException> {
66+
mockkObj.joinBySpace("a", "b", "c", "z")
67+
}.also { exception ->
68+
assertTrue(exception.message!!.startsWith("no answer found"))
69+
}
70+
6171
}
6272

6373

0 commit comments

Comments
 (0)