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

VerificationCollector to handle non-matching args and other assertions #1644

Merged

Conversation

kriegfrj
Copy link
Contributor

@kriegfrj kriegfrj commented Mar 4, 2019

This fix for #1642 widens the catch in VerificationCollectorImpl so that it will catch any AssertionError, rather than just MockitoAssertionError. In this way, any comparison failures (such as the built-in argument comparison when running under JUnit) will also be collected rather than propagating through to the test framework.

There are also two commits which are more cosmetic improvements to VerificationCollectorImplTest:

  • Rename assertAtLeastOneFailure() to assertExactlyOneFailure() (more accurate description of what it does).
  • Change Assert.fail() to AssertJ's assertBecauseExceptionWasNotThrown() (produces better diagnostics in the case of a failure).

@codecov-io
Copy link

codecov-io commented Mar 4, 2019

Codecov Report

Merging #1644 into release/2.x will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@              Coverage Diff               @@
##             release/2.x    #1644   +/-   ##
==============================================
  Coverage          87.38%   87.38%           
  Complexity          2434     2434           
==============================================
  Files                301      301           
  Lines               6271     6271           
  Branches             781      781           
==============================================
  Hits                5480     5480           
  Misses               596      596           
  Partials             195      195
Impacted Files Coverage Δ Complexity Δ
...kito/internal/junit/VerificationCollectorImpl.java 97.22% <100%> (ø) 7 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b745b5d...c7d5d8e. Read the comment docs.

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.

Thanks for the explanation in the issue and the easy fix + great tests!

@TimvdLippe TimvdLippe merged commit 73f1d17 into mockito:release/2.x Mar 4, 2019
@kriegfrj kriegfrj deleted the 1642-verification-collector-args branch March 4, 2019 09:53
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