Automated g4 rollback of changelist 367295097.
*** Reason for rollback ***
Roll forward after fixes
*** Original change description ***
Automated g4 rollback of changelist 367238585.
*** Reason for rollback ***
Broke https://test.corp.google.com/ui#cl=365134781&flags=CAMQBQ==&id=OCL:365134781:BASE:367271161:1617822936639:6a37b0ed&t=//chrome/cloudcast/client/gamerx/audio/test:active_controller_audio_service_test_ddc_headless-chrome-linux
*** Original change description ***
Import https://github.com/dart-lang/mockito/pull/376
***
***
PiperOrigin-RevId: 367657308
diff --git a/lib/src/mock.dart b/lib/src/mock.dart
index 4142f1f..44bec84 100644
--- a/lib/src/mock.dart
+++ b/lib/src/mock.dart
@@ -997,7 +997,10 @@
throw StateError(_verifyCalls.join());
}
_verificationInProgress = true;
- return <T>(List<T> _) {
+ return <T>(List<T> responses) {
+ if (responses.length != _verifyCalls.length) {
+ fail('Used on a non-mockito object');
+ }
_verificationInProgress = false;
var verificationResults = <VerificationResult>[];
var time = DateTime.fromMillisecondsSinceEpoch(0);
diff --git a/test/verify_test.dart b/test/verify_test.dart
index 59c2575..659fe07 100644
--- a/test/verify_test.dart
+++ b/test/verify_test.dart
@@ -206,6 +206,12 @@
'2 verify calls have been stored.')));
}
});
+
+ test('should fail when called with non-mock-call parameter', () {
+ expectFail('Used on a non-mockito object', () {
+ verifyInOrder(['a string is not a mock call']);
+ });
+ });
});
group('verify should fail when no matching call is found', () {
@@ -457,6 +463,12 @@
});
});
+ test('should fail when given non-mock-call parameters', () {
+ expectFail('Used on a non-mockito object', () {
+ verifyInOrder(['a string is not a mock call']);
+ });
+ });
+
test('verify been used as an argument fails', () {
mock.methodWithoutArgs();
mock.getter;