mockito
mockito copied to clipboard
Mockito-inspired mock library for Dart
### Code that I want to test: ``` final cachedResult = cacheBox.get(uri); if (cachedResult != null) controller.add(SWREvent( eventStatus: SWREventStatus.cacheResponse, data: cachedResult, swrMessage: 'returning the cached data first', )); /// make...
Based on [NULL_SAFETY_README.md](https://github.com/dart-lang/mockito/blob/master/NULL_SAFETY_README.md) looks like Mockito will be using code gen solution due to limitations introduced by NNBD explained in the same file. I'm creating this issue to discuss some...
In a simple app, if you import mockito into a flutter application test and then create any mock class (don't even have to use it) using `extends Mock` the debugger...
Here is a simplified test case of a bug I'm seeing with the `thenAnswer` Invocation when this code is compiled with dart2js. With DDC, it works as expected: ```dart import...
`verify(...).called(0)` does not work as one might expect, and mockito cannot give a good error message for it at runtime.
Mockito cannot throw any errors for this code, even though no stub result has been set: ```dart void main() { var a = MockA(); when(a.m1()); print('hey'); print('boo'); verify(a.m1()); } ```...
Unfortunately, mockito cannot catch a bug like this during runtime: ```dart when(a.m1(x: argThat(contains('foo'), 'y'), y: argThat(contains('bar'), 'x'))) .thenReturn(0); ``` noSuchMethod receives an arg (null) for `x`, and an argument matcher...
The [DeepCollectionEquality](https://pub.dartlang.org/documentation/collection/latest/collection/DeepCollectionEquality-class.html) class used for argument matching intentionally does not consider a List equivalent to a non-list Iterable, even if they have the same elements in the same order. Generally,...
When 3.x was released, `typed()` (which was now deprecated) was implemented as an arrow function returning `null` with `Null` as the return type in the signature. This means that any...
Error messaging for verification with incorrect called value could be more helpful by listing calls
Here's a sample error message: ``` Expected: ... Expected: Actual: Unexpected number of calls package:test expect package:mockito/src/mock.dart 666:5 VerificationResult.called ``` This message would be a lot more useful if it...