-
Notifications
You must be signed in to change notification settings - Fork 72
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
Retain Mockito Strictness WARN when switching to JUnit 5 through @MockitoSettings(strictness = Strictness.WARN)
#584
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
...ava/org/openrewrite/java/testing/junit5/MockitoJUnitAddMockitoSettingsLenientStrictness.java
Outdated
Show resolved
Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
timtebeek
reviewed
Aug 20, 2024
timtebeek
reviewed
Aug 20, 2024
...ava/org/openrewrite/java/testing/junit5/MockitoJUnitAddMockitoSettingsLenientStrictness.java
Outdated
Show resolved
Hide resolved
As preconditions only match the exact same file, and there's no guaranteed dependency marker available when visiting compilation units.
timtebeek
approved these changes
Aug 21, 2024
timtebeek
reviewed
Aug 21, 2024
...va/org/openrewrite/java/testing/mockito/MockitoJUnitAddMockitoSettingsLenientStrictness.java
Outdated
Show resolved
Hide resolved
timtebeek
reviewed
Aug 21, 2024
...va/org/openrewrite/java/testing/mockito/MockitoJUnitAddMockitoSettingsLenientStrictness.java
Outdated
Show resolved
Hide resolved
Correct header year Add comment about limitation of the recipe
timtebeek
changed the title
Retain lenient stubbing behaviour when using Mockito and migration from JUnit 4 to 5
Retain Mockito Strictness WARN when switching to JUnit 5 through Aug 21, 2024
@MockitoSettings(strictness = Strictness.WARN)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's changed?
Add a recipe to add
@MockitoSettings(strictness = Strictness.WARN)
so that the default behavior does not changeWhat's your motivation?
When switching from JUnit 4 to JUnit Jupiter the default for strictness changed from WARN to STRICT_STUBS, which could cause previously passing tests to now fail. That's not desirable, we'd rather keep them passing and warning about unnecessary stubs as seen before the migration.
Any additional context
Checklist