Bump mockito to 3.0.0-beta (#18462)

* Bump mockito to 3.0.0-beta

* Few fixes

* fix test

* Bump image

* Fix

* New packages update

* With matcher pinned

* No more typed
This commit is contained in:
Sam Rawlins
2018-06-21 16:23:47 -07:00
committed by Alexander Aprelev
parent bec912165a
commit 9f8a70be4c
32 changed files with 159 additions and 163 deletions

View File

@@ -27,7 +27,7 @@ import '../runner/flutter_command.dart';
/// ```
const Map<String, String> _kManuallyPinnedDependencies = const <String, String>{
// Add pinned packages here.
'mockito': '3.0.0-alpha+5', // TODO(aam): https://github.com/dart-lang/mockito/issues/110
'mockito': '3.0.0-beta', // TODO(aam): https://github.com/dart-lang/mockito/issues/110
'matcher': '0.12.2', // TODO(ianh): https://github.com/flutter/flutter/issues/18608, https://github.com/dart-lang/matcher/pull/88
};

View File

@@ -78,11 +78,11 @@ dependencies:
dev_dependencies:
collection: 1.14.6
mockito: 3.0.0-alpha+5
mockito: 3.0.0-beta
file_testing: 2.0.0
dartdoc:
# Exclude this package from the hosted API docs.
nodoc: true
# PUBSPEC CHECKSUM: 3ac4
# PUBSPEC CHECKSUM: baf9

View File

@@ -106,7 +106,7 @@ void main() {
verify(mockClock.now()).called(2);
expect(
verify(mockUsage.sendTiming(captureAny, captureAny, captureAny, label: captureAny)).captured,
verify(mockUsage.sendTiming(captureAny, captureAny, captureAny, label: captureAnyNamed('label'))).captured,
<dynamic>['flutter', 'doctor', const Duration(milliseconds: 1000), 'success']
);
}, overrides: <Type, Generator>{
@@ -125,7 +125,7 @@ void main() {
verify(mockClock.now()).called(2);
expect(
verify(mockUsage.sendTiming(captureAny, captureAny, captureAny, label: captureAny)).captured,
verify(mockUsage.sendTiming(captureAny, captureAny, captureAny, label: captureAnyNamed('label'))).captured,
<dynamic>['flutter', 'doctor', const Duration(milliseconds: 1000), 'warning']
);
}, overrides: <Type, Generator>{

View File

@@ -88,7 +88,7 @@ Use the 'android' tool to install them:
setUp(() {
hardware = 'unknown';
buildCharacteristics = 'unused';
when(mockProcessManager.run(typedArgThat(contains('getprop')),
when(mockProcessManager.run(argThat(contains('getprop')),
stderrEncoding: anyNamed('stderrEncoding'),
stdoutEncoding: anyNamed('stdoutEncoding'))).thenAnswer((_) {
final StringBuffer buf = new StringBuffer()

View File

@@ -74,7 +74,7 @@ void main() {
final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
when(processManager.canRun(sdk.sdkManagerPath)).thenReturn(true);
when(processManager.runSync(<String>[sdk.sdkManagerPath, '--version'],
environment: typedArgThat(isNotNull, named: 'environment')))
environment: argThat(isNotNull, named: 'environment')))
.thenReturn(new ProcessResult(1, 0, '26.1.1\n', ''));
expect(sdk.sdkManagerVersion, '26.1.1');
}, overrides: <Type, Generator>{
@@ -89,7 +89,7 @@ void main() {
final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
when(processManager.canRun(sdk.sdkManagerPath)).thenReturn(true);
when(processManager.runSync(<String>[sdk.sdkManagerPath, '--version'],
environment: typedArgThat(isNotNull, named: 'environment')))
environment: argThat(isNotNull, named: 'environment')))
.thenReturn(new ProcessResult(1, 1, '26.1.1\n', 'Mystery error'));
expect(sdk.sdkManagerVersion, isNull);
}, overrides: <Type, Generator>{

View File

@@ -142,7 +142,7 @@ void main() {
testUsingContext('creates swift Podfile if swift', () {
when(mockXcodeProjectInterpreter.isInstalled).thenReturn(true);
when(mockXcodeProjectInterpreter.getBuildSettings(typed(any), typed(any))).thenReturn(<String, String>{
when(mockXcodeProjectInterpreter.getBuildSettings(any, any)).thenReturn(<String, String>{
'SWIFT_VERSION': '4.0',
});
@@ -204,7 +204,7 @@ void main() {
iosEngineDir: 'engine/path',
);
verifyNever(mockProcessManager.run(
typedArgThat(containsAllInOrder(<String>['pod', 'install'])),
argThat(containsAllInOrder(<String>['pod', 'install'])),
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
));
@@ -226,7 +226,7 @@ void main() {
} catch(e) {
expect(e, const isInstanceOf<ToolExit>());
verifyNever(mockProcessManager.run(
typedArgThat(containsAllInOrder(<String>['pod', 'install'])),
argThat(containsAllInOrder(<String>['pod', 'install'])),
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
));
@@ -437,7 +437,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
);
expect(didInstall, isFalse);
verifyNever(mockProcessManager.run(
typedArgThat(containsAllInOrder(<String>['pod', 'install'])),
argThat(containsAllInOrder(<String>['pod', 'install'])),
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
));

View File

@@ -72,7 +72,7 @@ void main() {
when(mockProcessManager.runSync(<String>['which', 'openssl']))
.thenReturn(exitsHappy);
when(mockProcessManager.runSync(
typedArgThat(contains('find-identity')),
argThat(contains('find-identity')),
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory'),
)).thenReturn(exitsHappy);
@@ -97,7 +97,7 @@ void main() {
when(mockProcessManager.runSync(<String>['which', 'openssl']))
.thenReturn(exitsHappy);
when(mockProcessManager.runSync(
typedArgThat(contains('find-identity')),
argThat(contains('find-identity')),
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory'),
)).thenReturn(new ProcessResult(
@@ -124,7 +124,7 @@ void main() {
final MockStream mockStdErr = new MockStream();
when(mockProcessManager.start(
typedArgThat(contains('openssl')),
argThat(contains('openssl')),
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory'),
)).thenAnswer((Invocation invocation) => new Future<Process>.value(mockProcess));
@@ -156,7 +156,7 @@ void main() {
when(mockProcessManager.runSync(<String>['which', 'openssl']))
.thenReturn(exitsHappy);
when(mockProcessManager.runSync(
typedArgThat(contains('find-identity')),
argThat(contains('find-identity')),
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory'),
)).thenReturn(new ProcessResult(
@@ -183,7 +183,7 @@ void main() {
final MockStream mockStdErr = new MockStream();
when(mockProcessManager.start(
typedArgThat(contains('openssl')),
argThat(contains('openssl')),
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory'),
)).thenAnswer((Invocation invocation) => new Future<Process>.value(mockProcess));
@@ -219,7 +219,7 @@ void main() {
when(mockProcessManager.runSync(<String>['which', 'openssl']))
.thenReturn(exitsHappy);
when(mockProcessManager.runSync(
typedArgThat(contains('find-identity')),
argThat(contains('find-identity')),
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory'),
)).thenReturn(new ProcessResult(
@@ -250,7 +250,7 @@ void main() {
final MockStream mockOpenSslStdErr = new MockStream();
when(mockProcessManager.start(
typedArgThat(contains('openssl')),
argThat(contains('openssl')),
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory'),
)).thenAnswer((Invocation invocation) => new Future<Process>.value(mockOpenSslProcess));
@@ -293,7 +293,7 @@ void main() {
when(mockProcessManager.runSync(<String>['which', 'openssl']))
.thenReturn(exitsHappy);
when(mockProcessManager.runSync(
typedArgThat(contains('find-identity')),
argThat(contains('find-identity')),
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory'),
)).thenReturn(new ProcessResult(
@@ -324,7 +324,7 @@ void main() {
final MockStream mockOpenSslStdErr = new MockStream();
when(mockProcessManager.start(
typedArgThat(contains('openssl')),
argThat(contains('openssl')),
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory'),
)).thenAnswer((Invocation invocation) => new Future<Process>.value(mockOpenSslProcess));
@@ -361,7 +361,7 @@ void main() {
when(mockProcessManager.runSync(<String>['which', 'openssl']))
.thenReturn(exitsHappy);
when(mockProcessManager.runSync(
typedArgThat(contains('find-identity')),
argThat(contains('find-identity')),
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory'),
)).thenReturn(new ProcessResult(
@@ -390,7 +390,7 @@ void main() {
final MockStream mockOpenSslStdErr = new MockStream();
when(mockProcessManager.start(
typedArgThat(contains('openssl')),
argThat(contains('openssl')),
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory'),
)).thenAnswer((Invocation invocation) => new Future<Process>.value(mockOpenSslProcess));
@@ -431,7 +431,7 @@ void main() {
when(mockProcessManager.runSync(<String>['which', 'openssl']))
.thenReturn(exitsHappy);
when(mockProcessManager.runSync(
typedArgThat(contains('find-identity')),
argThat(contains('find-identity')),
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory'),
)).thenReturn(new ProcessResult(
@@ -463,7 +463,7 @@ void main() {
final MockStream mockOpenSslStdErr = new MockStream();
when(mockProcessManager.start(
typedArgThat(contains('openssl')),
argThat(contains('openssl')),
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory'),
)).thenAnswer((Invocation invocation) => new Future<Process>.value(mockOpenSslProcess));

View File

@@ -82,7 +82,7 @@ void main() {
testUsingContext('idevicescreenshot captures and returns screenshot', () async {
when(mockOutputFile.path).thenReturn(outputPath);
when(mockProcessManager.run(typed(any), environment: null, workingDirectory: null)).thenAnswer(
when(mockProcessManager.run(any, environment: null, workingDirectory: null)).thenAnswer(
(Invocation invocation) => new Future<ProcessResult>.value(new ProcessResult(4, 0, '', '')));
await iMobileDevice.takeScreenshot(mockOutputFile);

View File

@@ -175,7 +175,7 @@ void main() {
mockProcessManager = new MockProcessManager();
// Let everything else return exit code 0 so process.dart doesn't crash.
when(
mockProcessManager.run(typed(any), environment: null, workingDirectory: null)
mockProcessManager.run(any, environment: null, workingDirectory: null)
).thenAnswer((Invocation invocation) =>
new Future<ProcessResult>.value(new ProcessResult(2, 0, '', ''))
);
@@ -229,7 +229,7 @@ void main() {
setUp(() {
mockProcessManager = new MockProcessManager();
when(mockProcessManager.start(typed(any), environment: null, workingDirectory: null))
when(mockProcessManager.start(any, environment: null, workingDirectory: null))
.thenAnswer((Invocation invocation) => new Future<Process>.value(new MockProcess()));
});
@@ -237,7 +237,7 @@ void main() {
final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'iOS 9.3');
await launchDeviceLogTool(device);
expect(
verify(mockProcessManager.start(typed(captureAny), environment: null, workingDirectory: null)).captured.single,
verify(mockProcessManager.start(captureAny, environment: null, workingDirectory: null)).captured.single,
contains('tail'),
);
},
@@ -249,7 +249,7 @@ void main() {
final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'iOS 11.0');
await launchDeviceLogTool(device);
expect(
verify(mockProcessManager.start(typed(captureAny), environment: null, workingDirectory: null)).captured.single,
verify(mockProcessManager.start(captureAny, environment: null, workingDirectory: null)).captured.single,
contains('/usr/bin/log'),
);
},
@@ -271,7 +271,7 @@ void main() {
final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'iOS 9.3');
await launchSystemLogTool(device);
expect(
verify(mockProcessManager.start(typed(captureAny), environment: null, workingDirectory: null)).captured.single,
verify(mockProcessManager.start(captureAny, environment: null, workingDirectory: null)).captured.single,
contains('tail'),
);
},

View File

@@ -282,7 +282,7 @@ Information about project "Runner":
}
testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, typed(any))).thenReturn('engine');
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = const BuildInfo(BuildMode.debug, null,
previewDart2: true,
@@ -302,7 +302,7 @@ Information about project "Runner":
});
testUsingOsxContext('sets TRACK_WIDGET_CREATION=true when trackWidgetCreation is true', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, typed(any))).thenReturn('engine');
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = const BuildInfo(BuildMode.debug, null,
previewDart2: true,
@@ -323,7 +323,7 @@ Information about project "Runner":
});
testUsingOsxContext('does not set TRACK_WIDGET_CREATION when trackWidgetCreation is false', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, typed(any))).thenReturn('engine');
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = const BuildInfo(BuildMode.debug, null,
previewDart2: true,
@@ -343,7 +343,7 @@ Information about project "Runner":
});
testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, typed(any))).thenReturn('engine');
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile'));
const BuildInfo buildInfo = const BuildInfo(BuildMode.debug, null,
previewDart2: true,

View File

@@ -61,7 +61,7 @@ void main() {
expect(
verify(usage.sendTiming(
typed(captureAny), typed(captureAny), typed(captureAny),
captureAny, captureAny, captureAny,
label: captureAnyNamed('label'))).captured,
<dynamic>['flutter', 'dummy', const Duration(milliseconds: 1000), null]
);
@@ -80,8 +80,8 @@ void main() {
await flutterCommand.run();
verify(clock.now()).called(2);
verifyNever(usage.sendTiming(
typed(captureAny), typed(captureAny), typed(captureAny),
label: captureAnyNamed('label')));
any, any, any,
label: anyNamed('label')));
},
overrides: <Type, Generator>{
Clock: () => clock,
@@ -106,7 +106,7 @@ void main() {
verify(clock.now()).called(2);
expect(
verify(usage.sendTiming(
typed(captureAny), typed(captureAny), typed(captureAny),
captureAny, captureAny, captureAny,
label: captureAnyNamed('label'))).captured,
<dynamic>[
'flutter',
@@ -137,7 +137,7 @@ void main() {
expect(
verify(usage.sendTiming(
typed(captureAny), typed(captureAny), typed(captureAny),
captureAny, captureAny, captureAny,
label: captureAnyNamed('label'))).captured,
<dynamic>[
'flutter',