Skip to content

Conversation

@jselbo
Copy link
Contributor

@jselbo jselbo commented Oct 29, 2025

Thank you for submitting a pull request! But first:

  • Can you back your code up with tests?

See: mockito/mockito#2173

The original method had args MockedStatic.verify(VerificationMode, Verification)
but this was changed to MockedStatic.verify(Verification, VerificationMode) for consistency with Mockito.verify(T, VerificationMode)

From @raphw, the original author:

No, I don't think I had an intention with the order, possibly to have the lambda last what often works better with languages like Kotlin. But I think consistency is the better goal.

IMO, it's much nicer for Kotlin consumers to keep the Verification arg last despite the inconsistency with Mockito.verify.

Compare:

mocked.verify(
  { SomeObject.aStaticMethod() },
  times(2),
)

to:

mocked.verify(times(2)) { SomeObject.aStaticMethod() }

@raphw
Copy link
Member

raphw commented Oct 29, 2025

Not sure of this. I do not normally like having two ways of expressing the same thing, it makes code less recognizable. On the other side, I see how this is nicer to read in Kotlin, and the change only affects that language. No strong opinion on this, but if others want to merge this, I think this is the way to do it.

Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not thrilled about this either, but I understand that for Kotlin this is preferred.

@TimvdLippe TimvdLippe merged commit 0fda817 into mockito:main Oct 31, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants