From e59651f925917ed44a9bf27c37e80fc9992c0890 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Tue, 27 Mar 2018 10:38:20 -0700 Subject: [PATCH] Revert "Move mockito to 3.0.0-alpha. (#15949)" (#15979) This reverts commit a7e6225820719eec08ae3c79ce73ebeb8ec33523 as there are failing tests. --- dev/bots/pubspec.yaml | 2 +- dev/manual_tests/pubspec.yaml | 2 +- dev/manual_tests/test/mock_image_http.dart | 4 ++-- dev/tools/pubspec.yaml | 2 +- packages/flutter/pubspec.yaml | 2 +- packages/flutter/test/cupertino/refresh_test.dart | 2 +- packages/flutter/test/widgets/image_headers_test.dart | 4 ++-- packages/flutter_driver/pubspec.yaml | 2 +- packages/flutter_localizations/pubspec.yaml | 2 +- packages/flutter_tools/pubspec.yaml | 2 +- packages/flutter_tools/test/channel_test.dart | 8 ++++---- packages/flutter_tools/test/compile_test.dart | 2 +- packages/fuchsia_remote_debug_protocol/pubspec.yaml | 2 +- .../test/fuchsia_remote_connection_test.dart | 2 +- .../test/src/dart/dart_vm_test.dart | 8 ++++---- 15 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dev/bots/pubspec.yaml b/dev/bots/pubspec.yaml index 2d05400f6b..29660bd595 100644 --- a/dev/bots/pubspec.yaml +++ b/dev/bots/pubspec.yaml @@ -21,7 +21,7 @@ dependencies: dev_dependencies: test: 0.12.32+2 - mockito: 3.0.0-alpha+2 + mockito: 2.2.3 barback: 0.15.2+15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" boolean_selector: 1.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" diff --git a/dev/manual_tests/pubspec.yaml b/dev/manual_tests/pubspec.yaml index d02c5e3bc5..4c533e556e 100644 --- a/dev/manual_tests/pubspec.yaml +++ b/dev/manual_tests/pubspec.yaml @@ -13,7 +13,7 @@ dev_dependencies: flutter_test: sdk: flutter - mockito: 3.0.0-alpha+2 + mockito: 2.2.3 args: 1.4.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" async: 2.0.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" diff --git a/dev/manual_tests/test/mock_image_http.dart b/dev/manual_tests/test/mock_image_http.dart index 81703ed2ac..5446ee6825 100644 --- a/dev/manual_tests/test/mock_image_http.dart +++ b/dev/manual_tests/test/mock_image_http.dart @@ -11,9 +11,9 @@ MockHttpClient createMockImageHttpClient(SecurityContext _) { final MockHttpClientRequest request = new MockHttpClientRequest(); final MockHttpClientResponse response = new MockHttpClientResponse(); final MockHttpHeaders headers = new MockHttpHeaders(); - when(client.getUrl(typed(any))).thenAnswer((_) => new Future.value(request)); + when(client.getUrl(typed(any))).thenReturn(new Future.value(request)); when(request.headers).thenReturn(headers); - when(request.close()).thenAnswer((_) => new Future.value(response)); + when(request.close()).thenReturn(new Future.value(response)); when(response.contentLength).thenReturn(kTransparentImage.length); when(response.statusCode).thenReturn(HttpStatus.OK); when(response.listen(typed(any))).thenAnswer((Invocation invocation) { diff --git a/dev/tools/pubspec.yaml b/dev/tools/pubspec.yaml index 5f0f4d7489..2b5f504873 100644 --- a/dev/tools/pubspec.yaml +++ b/dev/tools/pubspec.yaml @@ -24,7 +24,7 @@ dependencies: dev_dependencies: test: 0.12.32+2 - mockito: 3.0.0-alpha+2 + mockito: 2.2.3 barback: 0.15.2+15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" boolean_selector: 1.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" diff --git a/packages/flutter/pubspec.yaml b/packages/flutter/pubspec.yaml index 0666d807bf..e2f5df354a 100644 --- a/packages/flutter/pubspec.yaml +++ b/packages/flutter/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - mockito: 3.0.0-alpha+2 + mockito: 2.2.3 args: 1.4.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" async: 2.0.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" diff --git a/packages/flutter/test/cupertino/refresh_test.dart b/packages/flutter/test/cupertino/refresh_test.dart index c91c039dc4..af07d2392c 100644 --- a/packages/flutter/test/cupertino/refresh_test.dart +++ b/packages/flutter/test/cupertino/refresh_test.dart @@ -59,7 +59,7 @@ void main() { } return refreshIndicator; }); - when(mockHelper.refreshTask()).thenAnswer((_) => refreshCompleter.future); + when(mockHelper.refreshTask()).thenReturn(refreshCompleter.future); }); SliverList buildAListOfStuff() { diff --git a/packages/flutter/test/widgets/image_headers_test.dart b/packages/flutter/test/widgets/image_headers_test.dart index 3b563b5eed..a7e94d82eb 100644 --- a/packages/flutter/test/widgets/image_headers_test.dart +++ b/packages/flutter/test/widgets/image_headers_test.dart @@ -27,9 +27,9 @@ void main() { verify(headers.add('flutter', 'flutter')).called(1); }, createHttpClient: (SecurityContext _) { - when(client.getUrl(typed(any))).thenAnswer((_) => new Future.value(request)); + when(client.getUrl(typed(any))).thenReturn(new Future.value(request)); when(request.headers).thenReturn(headers); - when(request.close()).thenAnswer((_) => new Future.value(response)); + when(request.close()).thenReturn(new Future.value(response)); when(response.contentLength).thenReturn(kTransparentImage.length); when(response.statusCode).thenReturn(HttpStatus.OK); when(response.listen(typed(any))).thenAnswer((Invocation invocation) { diff --git a/packages/flutter_driver/pubspec.yaml b/packages/flutter_driver/pubspec.yaml index 52ee8d85bb..3dd98b7bda 100644 --- a/packages/flutter_driver/pubspec.yaml +++ b/packages/flutter_driver/pubspec.yaml @@ -66,7 +66,7 @@ dependencies: dev_dependencies: test: 0.12.32+2 - mockito: 3.0.0-alpha+2 + mockito: 2.2.3 quiver: 0.28.0 # PUBSPEC CHECKSUM: 74e9 diff --git a/packages/flutter_localizations/pubspec.yaml b/packages/flutter_localizations/pubspec.yaml index a7ccc3e779..146e837205 100644 --- a/packages/flutter_localizations/pubspec.yaml +++ b/packages/flutter_localizations/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - mockito: 3.0.0-alpha+2 + mockito: 2.2.3 args: 1.4.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" async: 2.0.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" diff --git a/packages/flutter_tools/pubspec.yaml b/packages/flutter_tools/pubspec.yaml index 55a8fbdfc2..8be98d16c1 100644 --- a/packages/flutter_tools/pubspec.yaml +++ b/packages/flutter_tools/pubspec.yaml @@ -81,7 +81,7 @@ dependencies: dev_dependencies: collection: 1.14.6 - mockito: 3.0.0-alpha+2 + mockito: 2.2.3 dartdoc: # Exclude this package from the hosted API docs. diff --git a/packages/flutter_tools/test/channel_test.dart b/packages/flutter_tools/test/channel_test.dart index 4dadb3d752..b3bc3c8d82 100644 --- a/packages/flutter_tools/test/channel_test.dart +++ b/packages/flutter_tools/test/channel_test.dart @@ -46,14 +46,14 @@ void main() { ]); final Process process = new MockProcess(); - when(process.stdout).thenAnswer((_) => stdout); - when(process.stderr).thenAnswer((_) => const Stream>.empty()); - when(process.exitCode).thenAnswer((_) => new Future.value(0)); + when(process.stdout).thenReturn(stdout); + when(process.stderr).thenReturn(const Stream>.empty()); + when(process.exitCode).thenReturn(new Future.value(0)); when(mockProcessManager.start( ['git', 'branch', '-r'], workingDirectory: typed(any, named: 'workingDirectory'), environment: typed(any, named: 'environment'))) - .thenAnswer((_) => new Future.value(process)); + .thenReturn(new Future.value(process)); final ChannelCommand command = new ChannelCommand(); final CommandRunner runner = createTestCommandRunner(command); diff --git a/packages/flutter_tools/test/compile_test.dart b/packages/flutter_tools/test/compile_test.dart index c36edd8bb9..4d1fb9deef 100644 --- a/packages/flutter_tools/test/compile_test.dart +++ b/packages/flutter_tools/test/compile_test.dart @@ -30,7 +30,7 @@ void main() { when(mockFrontendServer.stderr) .thenAnswer((Invocation invocation) => mockFrontendServerStdErr); final StreamController stdErrStreamController = new StreamController(); - when(mockFrontendServerStdErr.transform(any)).thenAnswer((_) => stdErrStreamController.stream); + when(mockFrontendServerStdErr.transform(any)).thenReturn(stdErrStreamController.stream); when(mockFrontendServer.stdin).thenReturn(mockFrontendServerStdIn); when(mockProcessManager.canRun(any)).thenReturn(true); when(mockProcessManager.start(any)).thenAnswer( diff --git a/packages/fuchsia_remote_debug_protocol/pubspec.yaml b/packages/fuchsia_remote_debug_protocol/pubspec.yaml index d6ac6ed2a7..eb8f47f0a3 100644 --- a/packages/fuchsia_remote_debug_protocol/pubspec.yaml +++ b/packages/fuchsia_remote_debug_protocol/pubspec.yaml @@ -62,7 +62,7 @@ dependencies: yaml: 2.1.13 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" dev_dependencies: - mockito: 3.0.0-alpha+2 + mockito: 2.2.3 test: 0.12.32+2 # PUBSPEC CHECKSUM: 97d6 diff --git a/packages/fuchsia_remote_debug_protocol/test/fuchsia_remote_connection_test.dart b/packages/fuchsia_remote_debug_protocol/test/fuchsia_remote_connection_test.dart index df85bc2ec1..172a9a8210 100644 --- a/packages/fuchsia_remote_debug_protocol/test/fuchsia_remote_connection_test.dart +++ b/packages/fuchsia_remote_debug_protocol/test/fuchsia_remote_connection_test.dart @@ -100,7 +100,7 @@ void main() { mockPeerConnections.add(mp); uriConnections.add(uri); when(mp.sendRequest(typed(any), typed(any))) - .thenAnswer((_) => new Future>( + .thenReturn(new Future>( () => flutterViewCannedResponses[flutterViewIndex++])); return mp; }); diff --git a/packages/fuchsia_remote_debug_protocol/test/src/dart/dart_vm_test.dart b/packages/fuchsia_remote_debug_protocol/test/src/dart/dart_vm_test.dart index 2e47c460c5..aec9690888 100644 --- a/packages/fuchsia_remote_debug_protocol/test/src/dart/dart_vm_test.dart +++ b/packages/fuchsia_remote_debug_protocol/test/src/dart/dart_vm_test.dart @@ -86,7 +86,7 @@ void main() { Future mockVmConnectionFunction(Uri uri) { when(mockPeer.sendRequest( typed(any), typed>(any))) - .thenAnswer((_) => new Future>( + .thenReturn(new Future>( () => flutterViewCannedResponses)); return new Future(() => mockPeer); } @@ -135,7 +135,7 @@ void main() { Future mockVmConnectionFunction(Uri uri) { when(mockPeer.sendRequest( typed(any), typed>(any))) - .thenAnswer((_) => new Future>( + .thenReturn(new Future>( () => flutterViewCannedResponseMissingId)); return new Future(() => mockPeer); } @@ -173,7 +173,7 @@ void main() { Future mockVmConnectionFunction(Uri uri) { when(mockPeer.sendRequest( typed(any), typed>(any))) - .thenAnswer((_) => new Future>( + .thenReturn(new Future>( () => flutterViewCannedResponseMissingIsolateName)); return new Future(() => mockPeer); } @@ -208,7 +208,7 @@ void main() { // Return a command that will never complete. when(mockPeer.sendRequest( typed(any), typed>(any))) - .thenAnswer((_) => new Completer>().future); + .thenReturn(new Completer>().future); return new Future(() => mockPeer); }