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
JUnit 5 strict stubs check should not suppress the regular test failure #1928
JUnit 5 strict stubs check should not suppress the regular test failure #1928
Conversation
If the test fails, MockitoExtension should not check for strict stubs at the end of the test.
Good idea. Will review shortly. Thank you for the contribution! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice change thank you! Can you address my feedback? Looking forward to merging it!
|
||
assertThat(result.getStatus()).isEqualTo(TestExecutionResult.Status.FAILED); | ||
Throwable throwable = result.getThrowable().get(); | ||
assertThat(throwable).isInstanceOf(AssertionError.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make the assertion stronger by using a more specific exception? You can create a custom exception type in the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see you already did it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes ;)
Codecov Report
@@ Coverage Diff @@
## release/3.x #1928 +/- ##
==============================================
Coverage 86.67% 86.67%
Complexity 2526 2526
==============================================
Files 318 318
Lines 6650 6650
Branches 832 832
==============================================
Hits 5764 5764
Misses 685 685
Partials 201 201
Continue to review full report at Codecov.
|
If the test fails, MockitoExtension should not check for strict stubs at the end of the test, because the possible UnnecessaryStubbingException will end up as a suppressed exception on the test's initial failure.