Skip to content
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

Mockito 5 any() does not match a vararg int[] argument anymore. I need to use any(int[].class) to get the ArgumentMatcher to work #2998

Closed
hensan64 opened this issue May 3, 2023 · 2 comments · Fixed by #3003

Comments

@hensan64
Copy link

hensan64 commented May 3, 2023

Mockito 5.2.0/5.3.1 any() ArgumentMatcher does not match a vararg int[] argument anymore.
I need to use any(int[].class) to get the ArgumentMatcher to work.

This mocking does NOT WORK:
when(myMock.myMethod(eq(myOtherMock), any()).thenReturn(myResultMap);

This mocking DOES WORK:
when(myMock.myMethod(eq(myOtherMock), any(int[].class))).thenReturn(myResultMap);

@TimvdLippe
Copy link
Contributor

This breaking change is listed in the release notes of Mockito 5: https://github.com/mockito/mockito/releases/tag/v5.0.0

@TimvdLippe
Copy link
Contributor

@hensan64 Good catch on the wrong JavaDoc for these methods. Let me add these caveats to the JavaDoc.

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 a pull request may close this issue.

2 participants