Skip to content

Commit

Permalink
Add test with multiple vararg arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Osguima3 committed Feb 23, 2024
1 parent 4b545c2 commit 456c173
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/src/test/kotlin/test/OngoingStubbingTest.kt
Expand Up @@ -215,6 +215,22 @@ class OngoingStubbingTest : TestBase() {
expect(result).toBe("argument-result")
}

@Test
fun testOngoingStubbing_doAnswer_withDestructuredArguments() {
/* Given */
val mock = mock<Methods> {
on { varargBooleanResult(any(), any()) } doAnswer { (a: String, b: String) ->
a == b.trim()
}
}

/* When */
val result = mock.varargBooleanResult("argument", " argument ")

/* Then */
expect(result).toBe(true)
}

@Test
fun testMockStubbingAfterCreatingMock() {
val mock = mock<Methods>()
Expand Down

0 comments on commit 456c173

Please sign in to comment.