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

Retain Mockito Strictness WARN when switching to JUnit 5 through @MockitoSettings(strictness = Strictness.WARN) #584

Merged
merged 10 commits into from
Aug 21, 2024

Conversation

Laurens-W
Copy link
Contributor

@Laurens-W Laurens-W commented Aug 20, 2024

What's changed?

Add a recipe to add @MockitoSettings(strictness = Strictness.WARN) so that the default behavior does not change

What'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

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@Laurens-W Laurens-W added the enhancement New feature or request label Aug 20, 2024
@Laurens-W Laurens-W self-assigned this Aug 20, 2024
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@timtebeek timtebeek marked this pull request as ready for review August 21, 2024 11:31
@timtebeek timtebeek self-requested a review August 21, 2024 11:31
As preconditions only match the exact same file, and there's no guaranteed dependency marker available when visiting compilation units.
@timtebeek timtebeek self-requested a review August 21, 2024 12:20
@timtebeek 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 @MockitoSettings(strictness = Strictness.WARN) Aug 21, 2024
@timtebeek timtebeek merged commit 108e7fd into main Aug 21, 2024
2 checks passed
@timtebeek timtebeek deleted the mockito-strictness-default branch August 21, 2024 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants