Skip to content

Commit 456c173

Browse files
committed
Add test with multiple vararg arguments
1 parent 4b545c2 commit 456c173

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/src/test/kotlin/test/OngoingStubbingTest.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,22 @@ class OngoingStubbingTest : TestBase() {
215215
expect(result).toBe("argument-result")
216216
}
217217

218+
@Test
219+
fun testOngoingStubbing_doAnswer_withDestructuredArguments() {
220+
/* Given */
221+
val mock = mock<Methods> {
222+
on { varargBooleanResult(any(), any()) } doAnswer { (a: String, b: String) ->
223+
a == b.trim()
224+
}
225+
}
226+
227+
/* When */
228+
val result = mock.varargBooleanResult("argument", " argument ")
229+
230+
/* Then */
231+
expect(result).toBe(true)
232+
}
233+
218234
@Test
219235
fun testMockStubbingAfterCreatingMock() {
220236
val mock = mock<Methods>()

0 commit comments

Comments
 (0)