-
Notifications
You must be signed in to change notification settings - Fork 164
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
Make throwOnMissingStub
the default (eventually)
#154
Comments
+1 I like it. I thought we implemented something like this before and it was rolled back... |
This could technically land in Mockito 3, as we haven't released it yet, but I think we're too busy at the moment to execute the cleanup that this would require 😄 . |
If it is a flag as long as we leave the default as not throwing we should be able to land in 3 right? |
Whoops this fell off my radar and Mockito 3 landed. I say we add the feature in 3.x, default to not-throwing, and flip the default Mockito 4 or greater. |
Just checked, since this would be a good change for NNBD, and about 1/3 of all internal tests fail when flipping the default. |
Hi, Is there currently any way to globally opt-in to this behavior? |
This is the default when using @GenerateMocks to generate mocks; otherwise the default has not changed. I think we can definitely do this in 2022 though (possibly much code to touch inside Google which relies on the current default). |
This is a candidate for Mockito 4, and entirely opt-in before Mockito 4.
Rationale: The following currently "just works" in Mockito 3:
This is problematic:
null
, instead of NSM.when(...)
cases for them.My suggestion is to start with a global opt-in/out flag, i.e.:
The text was updated successfully, but these errors were encountered: