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

Added value class support #522

Merged
merged 4 commits into from
Jul 9, 2024
Merged

Conversation

LarsSven
Copy link
Contributor

@LarsSven LarsSven commented Jul 1, 2024

This MR serves to add support for value classes to Mockito Kotlin. Value classes currently break and there is no easy way around them, many users have had issues with this: #445

This MR adds an anyValueClass() and adds it to the any() and anyOrNull() implementation. I expect I may have done a few things non-optimally as I am not too familiar with Mockito's inner workings, but I look forward to feedback from someone who knows more about Mockito argument matchers than me to help me improve this. I do think it is important to get support for value classes.

@TimvdLippe
Copy link
Contributor

Not sure why, but tests are failing on this PR. Can you please take a look and ensure all tests are passing?

@LarsSven
Copy link
Contributor Author

LarsSven commented Jul 5, 2024

I resolved the issues with the tests, it was a relatively obscure issue that had to do with verify not being called for the test where we expected it to error out. I also went ahead and added more tests to test other scenarios like around null vs non-null and nested value classes.

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.

Awesome, thanks for the fix!

@TimvdLippe TimvdLippe merged commit 888e19d into mockito:main Jul 9, 2024
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.

2 participants