mockito
mockito copied to clipboard
Mockito-inspired mock library for Dart
I've seen people adding Mockito into **dev_dependencies** instead of **dependencies**. Either they are wrong or your help is outdated. What's the correct way to install Mockito?
On trying to mock a Riverpod StateNotifierProvider of (AutoDispose)FamilyNotifier - ``` @Riverpod(keepAlive: true) class ProjectDirectoryPath extends _$ProjectDirectoryPath { @override String? build() { return null; } } ``` Mockito code generation...
I created a `build.yaml` as [this](https://github.com/dart-lang/mockito/blob/master/build.yaml) but it's not creating a mock directory. I have tried many ways but none of them is working. is it because I need some...
I have a class A that has a method b(). The method B creates the object C with some specific args and execute the d() method. So A().b() calls C(specific...
When a class with fields or methods marked as `@Deprecated("someMessage")` are Mocked, the `@Deprecated` is stripped away from the resulting Mock class. It's very helpful for Dart Analysis to point...
Currently, `thenReturnInOrder` does not accept `Future`s or `Stream`s (similarly to `thenReturn`). I would like to be able to write the following code: ``` when(methodReturningStream).thenAnswerInOrder([ Stream.fromIterable([1, 2, 3]), Stream.fromIterable([4, 5, 6]),...
Hello, I'm trying to generate a mock for a class witch contains a getter, the source code of the class is: class AppContext { ... AppLocalizations get l10n => AppLocalizations.of(navigatorMaterialAppKey.currentContext!);...
I have some trouble when using sealed class. This is a sample : ```dart import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; // Annotation which generates the cat.mocks.dart library and the MockCat class. @GenerateNiceMocks([MockSpec()])...
I guess the main thing is to split the mock object itself from the mock configuration object. That would mean a breaking API change, but the fix will be trivial...
I found a very strange behavior of mockito. If you generate a model with the [freezed](https://pub.dev/packages/freezed) and want to mock it without adding the [json_serializable](https://pub.dev/packages/json_serializable) as a dependency, the mocked...