-
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
How to setup calling a function on a mock with a mock as parameter (with NNBD)? #306
Comments
Great catch. This is related to #305, in which it is requested that
Right, so without the
This test uses the old behavior ( |
I wouldn't call |
Those functions ( |
@denniskaselow You're completely right. The solution is to stop overriding any methods defined by |
This is fixed in 5.0.0-nullsafety.1. |
I have still this issue in 5.0.0 |
@radvansky-tomas I don't think your error is related to this issue. |
I still have this issue in mockito ^5.0.14
|
@MilanObrenovic I don't see any reason why your issue is related to this one. Feel free to open a new bug with a minimal reproduction case. |
Using 5.0.0-nullsafety.0.
I have a class
Foo
and a classBar
which I want to mock for use in the class I want to test. Both classes interact with each other. Before nullsafety I could simply set this up, but I'm not sure how I am supposed to do that post-NNBD because mockito itself uses methods on the mocks that aren't mocked and I don't think I should mock stuff so mockito works.Example:
The code fails in the
foo.process(bar);
line.The resulting error of the
default mock
test is:NoSuchMethodError: Object has no == method accepting arguments (_)
The resulting error of the
null mock
test is:type 'Null' is not a subtype of type 'bool'
The important part of the stacktrace is this:
If I do something stupid like
when(bar == bar).thenReturn(true);
I'll just get a stackoverflow.The text was updated successfully, but these errors were encountered: