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
Add global setting to set default strictness in test runners #2532
Comments
Good question! The intention was to switch the default in Mockito 4, but after user feedback, we decided to postpone that decision. That said, I do think we should have an optional global switch that turns on strictness. For that, the behavior should be as follows:
This also hopefully allows us to get easier user feedback on this feature, as more projects can turn this feature on and get more information on its behavior. |
In fact. Rather than making it a boolean, we probably want to mirror the values to be those of https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/quality/Strictness.html E.g. |
ref #1924 for tons of discussion as well |
Is this ready for dev? I would love to see it implemented, having to write it in every test or introduce a base class / custom rule seems like an overkill, especially that there are such easy (and global) ways to pick other config like mockmaker. |
Hey folks,
According to the docs, Mockito should have switched to strict mocks by default since v4. I've been eagerly waiting for this release, but it seems the feature is not there.
Furthermore, following the conversations here #2460, #1769 and #1517 I conclude that this is not something that is going to happen?
To clarify, I would like to do something like
mockito.strict = true
and expect the whole project to be evaluated as such (the default value can stay false). There is no easy way to enable strict mocks across the entire project.Would it be possible to get an official statement on the plans regarding this feature?
The text was updated successfully, but these errors were encountered: