Clarified strict mocks doc
In reality, Mockito is really using stricts mocks by default since 4 major release. So I think it is worth updating this doc :)
Do you have evidence it actually is the default? You say it is the default since 4 major releases. The current major release is v5. But what you linked to says since v4 and also just that it is intended to What you linked to is just a "planned to be the default for v4 though.
And for example https://github.com/mockito/mockito/blob/main/mockito-core/src/main/java/org/mockito/MockSettings.java#L373 says the default is lenient. For https://github.com/mockito/mockito/blob/main/mockito-core/src/main/java/org/mockito/junit/MockitoJUnit.java#L34 it seems the default is warn, so behavioral still lenient. Didn't look further.
It seems that you're right, I'm sorry. But at least, Mockito has planned to migrate to strict mocks for a very long time, initially it was planned to Mockito v3.
So I think it is at least it does not make much sense to say that Spock like Mockito relies on lenient mocks. Becuase Mockito does not recommend that.
Well, having a look at their docs I'd say even if it were enabled by default, it is not the strictness we talk about here.
As far as I understood those docs, even with using Mockito strict mode you still need to use verifyNoMoreInteractions to achieve the strictness we are talking about here.
It is "a bit stricter" by failing if you do stub a method and it gets called but with different arguments it fails and if you do stub a method and it is not called it fails. But that's imho merely a "mistyped" protection or "refactored" protection but not the strictness mentioned here where any call on the mock would fail. 🤷♂️
@leonard84 what do you think?
Unfortunately the term "strict" is used very differently. EasyMock for example also has a strict mode, that there means that also invocation order is checked.
Calling Mockito's verifyNoMoreInteractions is basically the same as adding 0 * _ to a Spec.
I agree with @Vampire that "strictness" is not well-defined. We can remove the Like Mockito intro, but saying that Mockito is strict by default would be wrong, they just recommend it.