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 #3286 : Mockito.only() points to the wanted call as unwanted if it is the first being calledIssue3286 #3287

Merged
merged 3 commits into from Mar 5, 2024

Conversation

PiotrPrzybylak
Copy link
Contributor

@PiotrPrzybylak PiotrPrzybylak commented Mar 2, 2024

Description and example is here: #3286

Is was planning to add third commit ( PiotrPrzybylak@5fe1060 ) that replaces code in Only with calls to other verifiers, but I will do it in other PR since it breaks some tests for now:

public class Only implements VerificationMode {

    private final Times once = new Times(1);

    private final NoMoreInteractions noMoreInteractions = new NoMoreInteractions();

    @Override
    public void verify(VerificationData data) {
        once.verify(data);
        noMoreInteractions.verify(data);
    }

    @Override
    public String toString() {
        return "Wanted invocations count: 1 and no other method invoked";
    }
}

  • 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

@codecov-commenter
Copy link

codecov-commenter commented Mar 2, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 12.52%. Comparing base (d0a919c) to head (f5f2718).

❗ Current head f5f2718 differs from pull request most recent head 0e5c94f. Consider uploading reports for the commit 0e5c94f to get more accurate results

Files Patch % Lines
...n/java/org/mockito/internal/verification/Only.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               main    #3287       +/-   ##
=============================================
- Coverage     85.33%   12.52%   -72.81%     
+ Complexity     2923      429     -2494     
=============================================
  Files           336      336               
  Lines          8906     8907        +1     
  Branches       1108     1109        +1     
=============================================
- Hits           7600     1116     -6484     
- Misses         1013     7577     +6564     
+ Partials        293      214       -79     

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

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.

Thank you for the great description and fix!

@TimvdLippe TimvdLippe merged commit 4058f07 into mockito:main Mar 5, 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.

None yet

3 participants