You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're trying to migrate our mockito-tests to null-safety. We followed the null-safety guide.
Now we see the following issues, when we are "working" with the stubs (like expect or indexOf in an array):
1) MissingStubError: 'hashCode'
MissingStubError: 'hashCode'
No stub was found which matches the arguments of this method call:
hashCode
2) MissingStubError: '=='
MissingStubError: '=='
No stub was found which matches the arguments of this method call:
==(MockDeviceModel)
3) MissingStubError: 'toString'
MissingStubError: 'toString'
No stub was found which matches the arguments of this method call:
toString()
Our use case
Our codes works on lists. Thereore, our tests use a list of mocks and thus, tried to compare them, which fails finally.
Our setup
dart: 2.13.0
flutter: 2.2.0
mockito: 5.0.8
Issue
Mocks do not handle hashCode / == / 'toString'
The text was updated successfully, but these errors were encountered:
boldt
changed the title
MissingStubError: 'hashCode' / '=='
MissingStubError: 'hashCode' / '==' / 'toString'
Jun 1, 2021
I think this might happen for any class which overrides toString, hashCode, or operator==, but it would be surprising that we haven't seen this error yet.
In any case, we do have bugs for classes which override these methods and add optional parameters, so we should fix the two in one go.
srawlins
added
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
P2
A bug or feature request we're likely to work on
labels
Jun 1, 2021
We're trying to migrate our mockito-tests to null-safety. We followed the null-safety guide.
Now we see the following issues, when we are "working" with the stubs (like
expect
orindexOf
in an array):1) MissingStubError: 'hashCode'
2) MissingStubError: '=='
3) MissingStubError: 'toString'
Our use case
Our codes works on lists. Thereore, our tests use a list of mocks and thus, tried to compare them, which fails finally.
Our setup
Issue
Mocks do not handle
hashCode
/==
/'toString'
The text was updated successfully, but these errors were encountered: