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

Fixes #3331 : Fix AdditionalMatchers.and() and AdditionalMatchers.or() not to swap the order of matchers #3335

Merged
merged 1 commit into from May 11, 2024

Conversation

dev-jonghoonpark
Copy link
Contributor

related issue: #3331

Motivation:

Modification:

  • Changed the assignment order of popMatcher() results.

Result:

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
  • Mention Fixes #<issue number> in the description if relevant
  • At least one commit should mention Fixes #<issue number> if relevant

@dev-jonghoonpark
Copy link
Contributor Author

@TimvdLippe

I midified the code based on your feedback, can you check it?

The test code works like this

and

  • If the test is sequential, it will be filtered out byany(String.class), so doSomeThing() will not return 1.
  • If it's not sequential, the test will fail with an error in argThat(String::isEmpty). (because the input is not a String)

or

  • If the test is sequential, any(Integer.class) will pass, so doSomeThing() will return 1.
  • If it is not sequential, the test will fail with an error in argThat(String::isEmpty). (because the input is not a String)

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.

This looks great, thank you so much!

@codecov-commenter
Copy link

codecov-commenter commented May 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.35%. Comparing base (fb9ff6d) to head (65a76c0).
Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3335      +/-   ##
============================================
+ Coverage     85.33%   85.35%   +0.02%     
- Complexity     2924     2926       +2     
============================================
  Files           336      336              
  Lines          8907     8907              
  Branches       1109     1109              
============================================
+ Hits           7601     7603       +2     
  Misses         1013     1013              
+ Partials        293      291       -2     

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

@dev-jonghoonpark
Copy link
Contributor Author

I'll check why the test is failing and fix it. ; )

@TimvdLippe
Copy link
Contributor

You can run ./gradlew spotlessApply to automatically fix it for you.

@TimvdLippe TimvdLippe merged commit 12cef84 into mockito:main May 11, 2024
18 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.

AdditionalMatchers.and() and or() swap matcher order
3 participants