Change async stubbing to use thenAnswer. (#13521)
* Change async stubbing to use thenAnswer.
Mockito now prohibits calling thenReturn with Futures and Streams. dart-lang/mockito#79
* Update all Mockito deps to 3.0.0.
* Revert "Update all Mockito deps to 3.0.0."
This reverts commit e8ab9d37c33d3d7fe384abde64ea5b4d72623c75.
I did not correctly update the mockito dep, and there's no easy way to update to 3.0 alpha right now.
* Change thenAnswer((_) => to thenAnswer((invocation) =>
* Add Invocation type to thenAnswer lambdas
diff --git a/packages/flutter_tools/test/ios/mac_test.dart b/packages/flutter_tools/test/ios/mac_test.dart
index 812c4a1..60f38db 100644
--- a/packages/flutter_tools/test/ios/mac_test.dart
+++ b/packages/flutter_tools/test/ios/mac_test.dart
@@ -81,8 +81,8 @@
testUsingContext('idevicescreenshot captures and returns screenshot', () async {
when(mockOutputFile.path).thenReturn(outputPath);
- when(mockProcessManager.run(any, environment: null, workingDirectory: null))
- .thenReturn(new Future<ProcessResult>.value(new ProcessResult(4, 0, '', '')));
+ when(mockProcessManager.run(any, environment: null, workingDirectory: null)).thenAnswer(
+ (Invocation invocation) => new Future<ProcessResult>.value(new ProcessResult(4, 0, '', '')));
await iMobileDevice.takeScreenshot(mockOutputFile);
verify(mockProcessManager.run(<String>['idevicescreenshot', outputPath],