From 7e8952c352d38e456f48b215a8c8522f7548bf8e Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Thu, 4 Feb 2021 00:42:29 -0800 Subject: [PATCH] Bump mockito to breaking change with fixes (#450) --- pubspec.yaml | 2 +- .../client_xhr_transport_test.dart | 8 ++- test/src/client_utils.mocks.dart | 67 +++++++++++-------- 3 files changed, 45 insertions(+), 32 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 0ab9acd..779fb60 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,7 +22,7 @@ dependencies: dev_dependencies: build_runner: ^1.11.0 build_test: ^1.3.4 - mockito: ^5.0.0-nullsafety.5 + mockito: ^5.0.0-nullsafety.6 path: ^1.8.0-nullsafety.3 test: ^1.16.0-nullsafety.16 stream_channel: ^2.1.0-nullsafety.3 diff --git a/test/client_tests/client_xhr_transport_test.dart b/test/client_tests/client_xhr_transport_test.dart index 1d05e25..afd3166 100644 --- a/test/client_tests/client_xhr_transport_test.dart +++ b/test/client_tests/client_xhr_transport_test.dart @@ -54,11 +54,13 @@ class MockHttpRequest extends Mock implements HttpRequest { final int status; @override - int get readyState => super.noSuchMethod(Invocation.getter(#readyState), -1); + int get readyState => + super.noSuchMethod(Invocation.getter(#readyState), returnValue: -1); @override - Map get responseHeaders => super - .noSuchMethod(Invocation.getter(#responseHeaders), {}); + Map get responseHeaders => + super.noSuchMethod(Invocation.getter(#responseHeaders), + returnValue: {}); } class MockXhrClientConnection extends XhrClientConnection { diff --git a/test/src/client_utils.mocks.dart b/test/src/client_utils.mocks.dart index 927733a..cb979aa 100644 --- a/test/src/client_utils.mocks.dart +++ b/test/src/client_utils.mocks.dart @@ -1,3 +1,7 @@ +// Mocks generated by Mockito 5.0.0-nullsafety.6 from annotations +// in grpc/test/src/client_utils.dart. +// Do not manually edit this file. + import 'dart:async' as _i3; import 'package:http2/src/hpack/hpack.dart' as _i4; @@ -5,7 +9,6 @@ import 'package:http2/transport.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: comment_references - // ignore_for_file: unnecessary_parenthesis class _FakeClientTransportStream extends _i1.Fake @@ -24,32 +27,35 @@ class MockClientTransportConnection extends _i1.Mock @override bool get isOpen => - (super.noSuchMethod(Invocation.getter(#isOpen), false) as bool); + (super.noSuchMethod(Invocation.getter(#isOpen), returnValue: false) + as bool); @override set onActiveStateChanged(_i2.ActiveStateHandler? callback) => - super.noSuchMethod(Invocation.setter(#onActiveStateChanged, callback)); + super.noSuchMethod(Invocation.setter(#onActiveStateChanged, callback), + returnValueForMissingStub: null); @override - _i3.Future get onInitialPeerSettingsReceived => (super.noSuchMethod( - Invocation.getter(#onInitialPeerSettingsReceived), Future.value(null)) - as _i3.Future); + _i3.Future get onInitialPeerSettingsReceived => + (super.noSuchMethod(Invocation.getter(#onInitialPeerSettingsReceived), + returnValue: Future.value(null)) as _i3.Future); @override _i2.ClientTransportStream makeRequest(List<_i4.Header>? headers, {bool? endStream = false}) => (super.noSuchMethod( Invocation.method(#makeRequest, [headers], {#endStream: endStream}), - _FakeClientTransportStream()) as _i2.ClientTransportStream); + returnValue: + _FakeClientTransportStream()) as _i2.ClientTransportStream); @override _i3.Future ping() => - (super.noSuchMethod(Invocation.method(#ping, []), Future.value(null)) - as _i3.Future); + (super.noSuchMethod(Invocation.method(#ping, []), + returnValue: Future.value(null)) as _i3.Future); @override _i3.Future finish() => - (super.noSuchMethod(Invocation.method(#finish, []), Future.value(null)) - as _i3.Future); + (super.noSuchMethod(Invocation.method(#finish, []), + returnValue: Future.value(null)) as _i3.Future); @override _i3.Future terminate() => - (super.noSuchMethod(Invocation.method(#terminate, []), Future.value(null)) - as _i3.Future); + (super.noSuchMethod(Invocation.method(#terminate, []), + returnValue: Future.value(null)) as _i3.Future); } /// A class which mocks [ClientTransportStream]. @@ -62,30 +68,35 @@ class MockClientTransportStream extends _i1.Mock } @override - _i3.Stream<_i2.TransportStreamPush> get peerPushes => (super.noSuchMethod( - Invocation.getter(#peerPushes), - Stream<_i2.TransportStreamPush>.empty()) - as _i3.Stream<_i2.TransportStreamPush>); + _i3.Stream<_i2.TransportStreamPush> get peerPushes => + (super.noSuchMethod(Invocation.getter(#peerPushes), + returnValue: Stream<_i2.TransportStreamPush>.empty()) + as _i3.Stream<_i2.TransportStreamPush>); @override - int get id => (super.noSuchMethod(Invocation.getter(#id), 0) as int); + int get id => + (super.noSuchMethod(Invocation.getter(#id), returnValue: 0) as int); @override - _i3.Stream<_i2.StreamMessage> get incomingMessages => (super.noSuchMethod( - Invocation.getter(#incomingMessages), - Stream<_i2.StreamMessage>.empty()) as _i3.Stream<_i2.StreamMessage>); + _i3.Stream<_i2.StreamMessage> get incomingMessages => + (super.noSuchMethod(Invocation.getter(#incomingMessages), + returnValue: Stream<_i2.StreamMessage>.empty()) + as _i3.Stream<_i2.StreamMessage>); @override - _i3.StreamSink<_i2.StreamMessage> get outgoingMessages => (super.noSuchMethod( - Invocation.getter(#outgoingMessages), - _FakeStreamSink<_i2.StreamMessage>()) - as _i3.StreamSink<_i2.StreamMessage>); + _i3.StreamSink<_i2.StreamMessage> get outgoingMessages => + (super.noSuchMethod(Invocation.getter(#outgoingMessages), + returnValue: _FakeStreamSink<_i2.StreamMessage>()) + as _i3.StreamSink<_i2.StreamMessage>); @override set onTerminated(void Function(int?)? value) => - super.noSuchMethod(Invocation.setter(#onTerminated, value)); + super.noSuchMethod(Invocation.setter(#onTerminated, value), + returnValueForMissingStub: null); @override void sendHeaders(List<_i4.Header>? headers, {bool? endStream = false}) => super.noSuchMethod( - Invocation.method(#sendHeaders, [headers], {#endStream: endStream})); + Invocation.method(#sendHeaders, [headers], {#endStream: endStream}), + returnValueForMissingStub: null); @override void sendData(List? bytes, {bool? endStream = false}) => super.noSuchMethod( - Invocation.method(#sendData, [bytes], {#endStream: endStream})); + Invocation.method(#sendData, [bytes], {#endStream: endStream}), + returnValueForMissingStub: null); }