-
-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix verifier logic for slots and different matchers #951
Conversation
val matchedCalls = allCallsForMockMethod.filter(matcher::match) | ||
|
||
if(matchedCalls.size > 1 && matcher.args.any { it is CapturingSlotMatcher<*> }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's OK if there are multiple calls overall but only one of them matches and will be captured
@@ -162,7 +163,7 @@ open class UnorderedCallVerifier( | |||
} | |||
|
|||
captureBlocks.add { | |||
for (call in allCallsForMockMethod) { | |||
for (call in matchedCalls) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
captureAnswer
was called for non-matched calls, which led to incorrect capturing results
mock.doSomething("1", capture(dataSlotId1)) | ||
mock.doSomething("2", capture(dataSlotId2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would not fail if left as is, because with different values of the first argument only 1 call will be matched in each case
// Each capture should have happened once because of different matchers for `id` argument | ||
assertEquals(slotList.size, 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously this was 4
Brilliant, thanks a lot for fixing this! |
Closes #774