Unverified Commit bffae215 authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

Again move mockito to 300plus2 (#15981)

* Revert "Revert "Move mockito to 3.0.0-alpha. (#15949)" (#15979)"

This reverts commit e59651f9.

* More thenReturn to thenAnswer when mocking Futures

* Revert "More thenReturn to thenAnswer when mocking Futures"

This reverts commit 194d2cf41754ad171efd6bb5898cf73bce5a75ab as we are reverting engine roll.

* Revert "Revert "More thenReturn to thenAnswer when mocking Futures""

This reverts commit 52c9e96b304b220f66d78a252fccea0c8e0ef24c.

* Add dependency override

* Fix issue
parent 31049a5a
...@@ -21,7 +21,7 @@ dependencies: ...@@ -21,7 +21,7 @@ dependencies:
dev_dependencies: dev_dependencies:
test: 0.12.32+2 test: 0.12.32+2
mockito: 2.2.3 mockito: 3.0.0-alpha+2
barback: 0.15.2+15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" 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" boolean_selector: 1.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
......
...@@ -13,7 +13,7 @@ dev_dependencies: ...@@ -13,7 +13,7 @@ dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
mockito: 2.2.3 mockito: 3.0.0-alpha+2
args: 1.4.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" 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" async: 2.0.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
......
...@@ -11,9 +11,9 @@ MockHttpClient createMockImageHttpClient(SecurityContext _) { ...@@ -11,9 +11,9 @@ MockHttpClient createMockImageHttpClient(SecurityContext _) {
final MockHttpClientRequest request = new MockHttpClientRequest(); final MockHttpClientRequest request = new MockHttpClientRequest();
final MockHttpClientResponse response = new MockHttpClientResponse(); final MockHttpClientResponse response = new MockHttpClientResponse();
final MockHttpHeaders headers = new MockHttpHeaders(); final MockHttpHeaders headers = new MockHttpHeaders();
when(client.getUrl(typed(any))).thenReturn(new Future<HttpClientRequest>.value(request)); when(client.getUrl(typed(any))).thenAnswer((_) => new Future<HttpClientRequest>.value(request));
when(request.headers).thenReturn(headers); when(request.headers).thenReturn(headers);
when(request.close()).thenReturn(new Future<HttpClientResponse>.value(response)); when(request.close()).thenAnswer((_) => new Future<HttpClientResponse>.value(response));
when(response.contentLength).thenReturn(kTransparentImage.length); when(response.contentLength).thenReturn(kTransparentImage.length);
when(response.statusCode).thenReturn(HttpStatus.OK); when(response.statusCode).thenReturn(HttpStatus.OK);
when(response.listen(typed(any))).thenAnswer((Invocation invocation) { when(response.listen(typed(any))).thenAnswer((Invocation invocation) {
......
...@@ -24,7 +24,7 @@ dependencies: ...@@ -24,7 +24,7 @@ dependencies:
dev_dependencies: dev_dependencies:
test: 0.12.32+2 test: 0.12.32+2
mockito: 2.2.3 mockito: 3.0.0-alpha+2
barback: 0.15.2+15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" 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" boolean_selector: 1.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
......
...@@ -16,7 +16,7 @@ dependencies: ...@@ -16,7 +16,7 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
mockito: 2.2.3 mockito: 3.0.0-alpha+2
args: 1.4.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" 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" async: 2.0.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
......
...@@ -59,7 +59,7 @@ void main() { ...@@ -59,7 +59,7 @@ void main() {
} }
return refreshIndicator; return refreshIndicator;
}); });
when(mockHelper.refreshTask()).thenReturn(refreshCompleter.future); when(mockHelper.refreshTask()).thenAnswer((_) => refreshCompleter.future);
}); });
SliverList buildAListOfStuff() { SliverList buildAListOfStuff() {
......
...@@ -27,9 +27,9 @@ void main() { ...@@ -27,9 +27,9 @@ void main() {
verify(headers.add('flutter', 'flutter')).called(1); verify(headers.add('flutter', 'flutter')).called(1);
}, createHttpClient: (SecurityContext _) { }, createHttpClient: (SecurityContext _) {
when(client.getUrl(typed(any))).thenReturn(new Future<HttpClientRequest>.value(request)); when(client.getUrl(typed(any))).thenAnswer((_) => new Future<HttpClientRequest>.value(request));
when(request.headers).thenReturn(headers); when(request.headers).thenReturn(headers);
when(request.close()).thenReturn(new Future<HttpClientResponse>.value(response)); when(request.close()).thenAnswer((_) => new Future<HttpClientResponse>.value(response));
when(response.contentLength).thenReturn(kTransparentImage.length); when(response.contentLength).thenReturn(kTransparentImage.length);
when(response.statusCode).thenReturn(HttpStatus.OK); when(response.statusCode).thenReturn(HttpStatus.OK);
when(response.listen(typed(any))).thenAnswer((Invocation invocation) { when(response.listen(typed(any))).thenAnswer((Invocation invocation) {
......
...@@ -66,7 +66,7 @@ dependencies: ...@@ -66,7 +66,7 @@ dependencies:
dev_dependencies: dev_dependencies:
test: 0.12.32+2 test: 0.12.32+2
mockito: 2.2.3 mockito: 3.0.0-alpha+2
quiver: 0.28.0 quiver: 0.28.0
# PUBSPEC CHECKSUM: 74e9 # PUBSPEC CHECKSUM: 74e9
...@@ -37,9 +37,9 @@ void main() { ...@@ -37,9 +37,9 @@ void main() {
mockVM = new MockVM(); mockVM = new MockVM();
mockIsolate = new MockIsolate(); mockIsolate = new MockIsolate();
mockPeer = new MockPeer(); mockPeer = new MockPeer();
when(mockClient.getVM()).thenReturn(new Future<MockVM>.value(mockVM)); when(mockClient.getVM()).thenAnswer((_) => new Future<MockVM>.value(mockVM));
when(mockVM.isolates).thenReturn(<VMRunnableIsolate>[mockIsolate]); when(mockVM.isolates).thenReturn(<VMRunnableIsolate>[mockIsolate]);
when(mockIsolate.loadRunnable()).thenReturn(new Future<MockIsolate>.value(mockIsolate)); when(mockIsolate.loadRunnable()).thenAnswer((_) => new Future<MockIsolate>.value(mockIsolate));
when(mockIsolate.invokeExtension(typed(any), typed(any))).thenAnswer( when(mockIsolate.invokeExtension(typed(any), typed(any))).thenAnswer(
(Invocation invocation) => makeMockResponse(<String, dynamic>{'status': 'ok'})); (Invocation invocation) => makeMockResponse(<String, dynamic>{'status': 'ok'}));
vmServiceConnectFunction = (String url) { vmServiceConnectFunction = (String url) {
......
...@@ -15,7 +15,7 @@ dependencies: ...@@ -15,7 +15,7 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
mockito: 2.2.3 mockito: 3.0.0-alpha+2
args: 1.4.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" 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" async: 2.0.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
......
...@@ -27,6 +27,7 @@ import '../runner/flutter_command.dart'; ...@@ -27,6 +27,7 @@ import '../runner/flutter_command.dart';
/// ``` /// ```
const Map<String, String> _kManuallyPinnedDependencies = const <String, String>{ const Map<String, String> _kManuallyPinnedDependencies = const <String, String>{
// Add pinned packages here. // Add pinned packages here.
'mockito': '3.0.0-alpha+2', // TODO(aam): https://github.com/dart-lang/mockito/issues/110
}; };
class UpdatePackagesCommand extends FlutterCommand { class UpdatePackagesCommand extends FlutterCommand {
......
...@@ -81,7 +81,7 @@ dependencies: ...@@ -81,7 +81,7 @@ dependencies:
dev_dependencies: dev_dependencies:
collection: 1.14.6 collection: 1.14.6
mockito: 2.2.3 mockito: 3.0.0-alpha+2
dartdoc: dartdoc:
# Exclude this package from the hosted API docs. # Exclude this package from the hosted API docs.
......
...@@ -46,14 +46,14 @@ void main() { ...@@ -46,14 +46,14 @@ void main() {
]); ]);
final Process process = new MockProcess(); final Process process = new MockProcess();
when(process.stdout).thenReturn(stdout); when(process.stdout).thenAnswer((_) => stdout);
when(process.stderr).thenReturn(const Stream<List<int>>.empty()); when(process.stderr).thenAnswer((_) => const Stream<List<int>>.empty());
when(process.exitCode).thenReturn(new Future<int>.value(0)); when(process.exitCode).thenAnswer((_) => new Future<int>.value(0));
when(mockProcessManager.start( when(mockProcessManager.start(
<String>['git', 'branch', '-r'], <String>['git', 'branch', '-r'],
workingDirectory: typed(any, named: 'workingDirectory'), workingDirectory: typed(any, named: 'workingDirectory'),
environment: typed(any, named: 'environment'))) environment: typed(any, named: 'environment')))
.thenReturn(new Future<Process>.value(process)); .thenAnswer((_) => new Future<Process>.value(process));
final ChannelCommand command = new ChannelCommand(); final ChannelCommand command = new ChannelCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<Null> runner = createTestCommandRunner(command);
......
...@@ -30,7 +30,7 @@ void main() { ...@@ -30,7 +30,7 @@ void main() {
when(mockFrontendServer.stderr) when(mockFrontendServer.stderr)
.thenAnswer((Invocation invocation) => mockFrontendServerStdErr); .thenAnswer((Invocation invocation) => mockFrontendServerStdErr);
final StreamController<String> stdErrStreamController = new StreamController<String>(); final StreamController<String> stdErrStreamController = new StreamController<String>();
when(mockFrontendServerStdErr.transform<String>(any)).thenReturn(stdErrStreamController.stream); when(mockFrontendServerStdErr.transform<String>(any)).thenAnswer((_) => stdErrStreamController.stream);
when(mockFrontendServer.stdin).thenReturn(mockFrontendServerStdIn); when(mockFrontendServer.stdin).thenReturn(mockFrontendServerStdIn);
when(mockProcessManager.canRun(any)).thenReturn(true); when(mockProcessManager.canRun(any)).thenReturn(true);
when(mockProcessManager.start(any)).thenAnswer( when(mockProcessManager.start(any)).thenAnswer(
......
...@@ -62,7 +62,7 @@ dependencies: ...@@ -62,7 +62,7 @@ dependencies:
yaml: 2.1.13 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" yaml: 2.1.13 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies: dev_dependencies:
mockito: 2.2.3 mockito: 3.0.0-alpha+2
test: 0.12.32+2 test: 0.12.32+2
# PUBSPEC CHECKSUM: 97d6 # PUBSPEC CHECKSUM: 97d6
...@@ -31,7 +31,7 @@ void main() { ...@@ -31,7 +31,7 @@ void main() {
const String interface = 'eno1'; const String interface = 'eno1';
// Adds some extra junk to make sure the strings will be cleaned up. // Adds some extra junk to make sure the strings will be cleaned up.
when(mockRunner.run(typed(any))) when(mockRunner.run(typed(any)))
.thenReturn(new Future<List<String>>.value( .thenAnswer((_) => new Future<List<String>>.value(
<String>['123\n\n\n', '456 ', '789'])); <String>['123\n\n\n', '456 ', '789']));
when(mockRunner.address).thenReturn(address); when(mockRunner.address).thenReturn(address);
when(mockRunner.interface).thenReturn(interface); when(mockRunner.interface).thenReturn(interface);
...@@ -100,7 +100,7 @@ void main() { ...@@ -100,7 +100,7 @@ void main() {
mockPeerConnections.add(mp); mockPeerConnections.add(mp);
uriConnections.add(uri); uriConnections.add(uri);
when(mp.sendRequest(typed<String>(any), typed<String>(any))) when(mp.sendRequest(typed<String>(any), typed<String>(any)))
.thenReturn(new Future<Map<String, dynamic>>( .thenAnswer((_) => new Future<Map<String, dynamic>>(
() => flutterViewCannedResponses[flutterViewIndex++])); () => flutterViewCannedResponses[flutterViewIndex++]));
return mp; return mp;
}); });
......
...@@ -86,7 +86,7 @@ void main() { ...@@ -86,7 +86,7 @@ void main() {
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) { Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
when(mockPeer.sendRequest( when(mockPeer.sendRequest(
typed<String>(any), typed<Map<String, dynamic>>(any))) typed<String>(any), typed<Map<String, dynamic>>(any)))
.thenReturn(new Future<Map<String, dynamic>>( .thenAnswer((_) => new Future<Map<String, dynamic>>(
() => flutterViewCannedResponses)); () => flutterViewCannedResponses));
return new Future<json_rpc.Peer>(() => mockPeer); return new Future<json_rpc.Peer>(() => mockPeer);
} }
...@@ -135,7 +135,7 @@ void main() { ...@@ -135,7 +135,7 @@ void main() {
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) { Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
when(mockPeer.sendRequest( when(mockPeer.sendRequest(
typed<String>(any), typed<Map<String, dynamic>>(any))) typed<String>(any), typed<Map<String, dynamic>>(any)))
.thenReturn(new Future<Map<String, dynamic>>( .thenAnswer((_) => new Future<Map<String, dynamic>>(
() => flutterViewCannedResponseMissingId)); () => flutterViewCannedResponseMissingId));
return new Future<json_rpc.Peer>(() => mockPeer); return new Future<json_rpc.Peer>(() => mockPeer);
} }
...@@ -173,7 +173,7 @@ void main() { ...@@ -173,7 +173,7 @@ void main() {
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) { Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
when(mockPeer.sendRequest( when(mockPeer.sendRequest(
typed<String>(any), typed<Map<String, dynamic>>(any))) typed<String>(any), typed<Map<String, dynamic>>(any)))
.thenReturn(new Future<Map<String, dynamic>>( .thenAnswer((_) => new Future<Map<String, dynamic>>(
() => flutterViewCannedResponseMissingIsolateName)); () => flutterViewCannedResponseMissingIsolateName));
return new Future<json_rpc.Peer>(() => mockPeer); return new Future<json_rpc.Peer>(() => mockPeer);
} }
...@@ -208,7 +208,7 @@ void main() { ...@@ -208,7 +208,7 @@ void main() {
// Return a command that will never complete. // Return a command that will never complete.
when(mockPeer.sendRequest( when(mockPeer.sendRequest(
typed<String>(any), typed<Map<String, dynamic>>(any))) typed<String>(any), typed<Map<String, dynamic>>(any)))
.thenReturn(new Completer<Map<String, dynamic>>().future); .thenAnswer((_) => new Completer<Map<String, dynamic>>().future);
return new Future<json_rpc.Peer>(() => mockPeer); return new Future<json_rpc.Peer>(() => mockPeer);
} }
......
...@@ -40,8 +40,8 @@ void main() { ...@@ -40,8 +40,8 @@ void main() {
setUp(() { setUp(() {
mockProcessManager = new MockProcessManager(); mockProcessManager = new MockProcessManager();
mockProcessResult = new MockProcessResult(); mockProcessResult = new MockProcessResult();
when(mockProcessManager.run(typed(any))).thenReturn( when(mockProcessManager.run(typed(any))).thenAnswer(
new Future<MockProcessResult>.value(mockProcessResult)); (_) => new Future<MockProcessResult>.value(mockProcessResult));
}); });
test('verify interface is appended to ipv6 address', () async { test('verify interface is appended to ipv6 address', () async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment