Skip to content

Adds output of matchers to potential mismatch; Fixes #2468 - #3760

Merged
TimvdLippe merged 2 commits into
mockito:mainfrom
Zylox:issue-2468
Nov 14, 2025
Merged

TimvdLippe merged 2 commits into
mockito:mainfrom
Zylox:issue-2468

Conversation

@Zylox

@Zylox Zylox commented Nov 13, 2025 •

Copy link
Copy Markdown
Contributor

Checklist

  • Read the contributing guide
  • PR should be motivated, i.e. what does it fix, why, and if relevant how
  • If possible / relevant include an example in the description, that could help all readers
    including project members to get a better picture of the change
  • Avoid other runtime dependencies
  • Meaningful commit history ; intention is important please rebase your commit history so that each
    commit is meaningful and help the people that will explore a change in 2 years
  • The pull request follows coding style (run ./gradlew spotlessApply for auto-formatting)
  • Mention Fixes #<issue number> in the description if relevant
  • At least one commit should end with Fixes #<issue number> if relevant

An example of what this looked like before, as described in #2468
Screenshot 2025-11-13 at 4 33 01 PM

This brings matchers more in line with the kind of output verify outputs for similar operations. It does also add what the stub is configured to return, such as stubbed with: [Returns: 40], which im less opinionated about. I could see it being useful though, and it would be more effort to remove it, so i left it until someone requests otherwise.

If im missing some part of the process or this needs further work, more than happy to hear about it.

@TimvdLippe TimvdLippe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work, excited to see this land! Can we also add a testcase that uses the argThat as mentioned in #2468 That way we know how we serialize argThat matchers and if that is human readable. Thanks!

@codecov-commenter

codecov-commenter commented Nov 14, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.46%. Comparing base (58ba445) to head (6e5039d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3760      +/-   ##
============================================
+ Coverage     86.45%   86.46%   +0.01%     
  Complexity     2988     2988              
============================================
  Files           341      341              
  Lines          9041     9041              
  Branches       1113     1113              
============================================
+ Hits           7816     7817       +1     
+ Misses          943      942       -1     
  Partials        282      282              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Zylox

Zylox commented Nov 14, 2025

Copy link
Copy Markdown
Contributor Author

Nice work, excited to see this land! Can we also add a testcase that uses the argThat as mentioned in #2468 That way we know how we serialize argThat matchers and if that is human readable. Thanks!

6e5039d added. Output is definitely human readable, though making it more specific feels like it would need an argThat overload that accepts a description string. That could be a good followup.

@TimvdLippe TimvdLippe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for contributing! Would be good to indeed add an additional method so that argThat matchers can optionally add a description as well.

@TimvdLippe
TimvdLippe merged commit 756a3cf into mockito:main Nov 14, 2025
19 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