Commit 1f76f7f9 authored by Sam Rawlins's avatar Sam Rawlins Committed by Alexander Aprelev

Migrate to Mockito 3's anyNamed (#17632)

parent 20512d45
......@@ -15,9 +15,9 @@ void main() {
response = new MockHttpClientResponse();
when(response.listen(
typed(any),
onDone: typed(any, named: 'onDone'),
onError: typed(any, named: 'onError'),
cancelOnError: typed(any, named: 'cancelOnError')
onDone: anyNamed('onDone'),
onError: anyNamed('onError'),
cancelOnError: anyNamed('cancelOnError')
)).thenAnswer((Invocation invocation) {
final void Function(List<int>) onData = invocation.positionalArguments[0];
final void Function(Object) onError = invocation.namedArguments[#onError];
......@@ -46,9 +46,9 @@ void main() {
test('forwards errors from HttpClientResponse', () async {
when(response.listen(
typed(any),
onDone: typed(any, named: 'onDone'),
onError: typed(any, named: 'onError'),
cancelOnError: typed(any, named: 'cancelOnError')
onDone: anyNamed('onDone'),
onError: anyNamed('onError'),
cancelOnError: anyNamed('cancelOnError')
)).thenAnswer((Invocation invocation) {
final void Function(List<int>) onData = invocation.positionalArguments[0];
final void Function(Object) onError = invocation.namedArguments[#onError];
......@@ -65,4 +65,4 @@ void main() {
});
}
class MockHttpClientResponse extends Mock implements HttpClientResponse {}
\ No newline at end of file
class MockHttpClientResponse extends Mock implements HttpClientResponse {}
......@@ -51,8 +51,8 @@ void main() {
when(process.exitCode).thenAnswer((_) => new Future<int>.value(0));
when(mockProcessManager.start(
<String>['git', 'branch', '-r'],
workingDirectory: typed(any, named: 'workingDirectory'),
environment: typed(any, named: 'environment')))
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment')))
.thenAnswer((_) => new Future<Process>.value(process));
final ChannelCommand command = new ChannelCommand();
......@@ -60,8 +60,8 @@ void main() {
await runner.run(<String>['channel']);
verify(mockProcessManager.start(<String>['git', 'branch', '-r'],
workingDirectory: typed(any, named: 'workingDirectory'),
environment: typed(any, named: 'environment'))).called(1);
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'))).called(1);
expect(testLogger.errorText, hasLength(0));
......@@ -81,4 +81,4 @@ void main() {
class MockProcessManager extends Mock implements ProcessManager {}
class MockProcess extends Mock implements Process {}
\ No newline at end of file
class MockProcess extends Mock implements Process {}
......@@ -206,7 +206,7 @@ void main() {
verifyNever(mockProcessManager.run(
argThat(containsAllInOrder(<String>['pod', 'install'])),
workingDirectory: any,
environment: typed<Map<String, String>>(any, named: 'environment'),
environment: anyNamed('environment'),
));
expect(testLogger.errorText, contains('not installed'));
expect(testLogger.errorText, contains('Skipping pod install'));
......@@ -228,7 +228,7 @@ void main() {
verifyNever(mockProcessManager.run(
argThat(containsAllInOrder(<String>['pod', 'install'])),
workingDirectory: any,
environment: typed<Map<String, String>>(any, named: 'environment'),
environment: anyNamed('environment'),
));
}
}, overrides: <Type, Generator>{
......@@ -439,7 +439,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
verifyNever(mockProcessManager.run(
argThat(containsAllInOrder(<String>['pod', 'install'])),
workingDirectory: any,
environment: typed<Map<String, String>>(any, named: 'environment'),
environment: anyNamed('environment'),
));
}, overrides: <Type, Generator>{
FileSystem: () => fs,
......
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