dart-lang / mockito

Mockito-inspired mock library for Dart
https://pub.dev/packages/mockito
Apache License 2.0
623 stars 160 forks source link

Bad state: Cannot call `when` within a stub response #737

Closed dwikyhardi closed 2 months ago

dwikyhardi commented 4 months ago

hey i have this test for my code, it's behaving as expected if I run it one by one in Android studio. but it's throwing error when I run the group test or the whole test.

Here's my test code: ```dart group('getCurrentUser from server', () { test('should return Right(User) when getting current user is successful', () async { when(mockLocalDatasource.saveCurrentUser(mockUser)) .thenAnswer((_) async => Future(() {})); when(mockRemoteDatasource.getCurrentUser()) .thenAnswer((_) async => mockUser); when(mockNetworkInfo.isConnected).thenAnswer((_) async => true); when(mockIntercom.updateUser( userId: mockUser.pk, email: mockUser.username, company: mockUser.organization?.displayName, companyId: mockUser.organization?.pk, name: mockUser.fullName, phone: mockUser.mobile, customAttributes: { 'isOwner': true, 'isAdmin': true, }, )); final result = await authRepository.getCurrentUser(GetDataFromEnum.remoteData); expect(result, equals(Right(mockUser))); expectMethodCall('updateUser', arguments: { 'userId': mockUser.pk, 'email': mockUser.username, 'company': mockUser.organization?.displayName, 'companyId': mockUser.organization?.pk, 'name': mockUser.fullName, 'phone': mockUser.mobile, 'customAttributes': { 'isOwner': true, 'isAdmin': true, }, 'signedUpAt': null, 'language': null, }); verify(mockRemoteDatasource.getCurrentUser()).called(1); verify(mockLocalDatasource.saveCurrentUser(mockUser)).called(1); }); test( 'should return Left(ServerFailure) when getting current user fails because the server throw error', () async { when(mockRemoteDatasource.getCurrentUser()).thenThrow( ServerException(errorCode: 500, message: 'Server Error'), ); when(mockNetworkInfo.isConnected).thenAnswer((_) async => true); final result = await authRepository.getCurrentUser(GetDataFromEnum.remoteData); expect(result, equals(Left(ServerFailure(errorCode: 500, message: 'Server Error')))); verify(mockRemoteDatasource.getCurrentUser()).called(1); verifyNever(mockLocalDatasource.saveCurrentUser(mockUser)).called(0); }); test( 'should return Left(UnauthorizedFailure) when getting current user fails because the JWT token is expired', () async { when(mockRemoteDatasource.getCurrentUser()).thenThrow( UnauthorizedException(message: 'Unauthorized error'), ); when(mockNetworkInfo.isConnected).thenAnswer((_) async => true); final result = await authRepository.getCurrentUser(GetDataFromEnum.remoteData); expect(result, equals(Left(UnauthorizedFailure(message: 'Unauthorized error')))); verify(mockRemoteDatasource.getCurrentUser()).called(1); verifyNever(mockLocalDatasource.saveCurrentUser(mockUser)).called(0); }); test( 'should return Left(NetworkFailure) when getting current user fails because the connection was lost', () async { when(mockNetworkInfo.isConnected).thenAnswer((_) async => false); final result = await authRepository.getCurrentUser(GetDataFromEnum.remoteData); expect(result, isA>()); verifyNever(mockRemoteDatasource.getCurrentUser()).called(0); verifyNever(mockLocalDatasource.saveCurrentUser(mockUser)).called(0); }); }); ```

when I throw exception I got this error

Bad state: Cannot call `when` within a stub response

the error is located when I called when method for adding stub to my method, in this case always the first line in every test()

srawlins commented 4 months ago

Sorry we cannot debug your issue without a complete reproduction. But answers to specific questions may help: What do you mean by "when I throw exception I got this error"? You say "it's behaving as expected if I run it one by one" so I don't understand what the thrown exception has to do with things... is there a stack trace?

dwikyhardi commented 4 months ago

I can't debug it too.

here's the test -v ```log /Users/dwiky/StudioProjects/monit-mobile/.fvm/flutter_sdk/bin/flutter --no-color test --machine --start-paused --plain-name "getCurrentUser from server" -v test/features/auth/infrastructure/repositories/auth_repository_impl/getCurrentUser.welltested_test.dart Testing started at 10.00 ... [ +3 ms] executing: sw_vers -productName [ +9 ms] Exit code 0 from: sw_vers -productName [ ] macOS [ ] executing: sw_vers -productVersion [ +5 ms] Exit code 0 from: sw_vers -productVersion [ ] 14.3 [ ] executing: sw_vers -buildVersion [ +5 ms] Exit code 0 from: sw_vers -buildVersion [ ] 23D56 [ ] executing: uname -m [ +1 ms] Exit code 0 from: uname -m [ ] arm64 [ +2 ms] executing: sysctl hw.optional.arm64 [ +1 ms] Exit code 0 from: sysctl hw.optional.arm64 [ ] hw.optional.arm64: 1 [ +30 ms] Found 1 files which will be executed as Widget Tests. [ +2 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update. [ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +15 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update. [ ] Artifact Instance of 'GradleWrapper' is not required, skipping update. [ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update. [ ] Artifact Instance of 'FlutterSdk' is not required, skipping update. [ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update. [ ] Artifact Instance of 'PubDependencies' is not required, skipping update. [ +27 ms] Initializing file store [ ] Done initializing file store [ +7 ms] Skipping target: gen_localizations [ ] Persisting file store [ +1 ms] Done persisting file store [ +3 ms] Skipping pub get: version match. [ +27 ms] Found plugin convex_bottom_app_bar at /Users/dwiky/.pub-cache/git/convex_bottom_app_bar-8621a3ca8531e872998e8271006c395238520781/ [ +11 ms] Found plugin app_settings at /Users/dwiky/.pub-cache/hosted/pub.dev/app_settings-5.1.1/ [ +20 ms] Found plugin cloud_firestore at /Users/dwiky/.pub-cache/hosted/pub.dev/cloud_firestore-4.12.0/ [ +1 ms] Found plugin cloud_firestore_web at /Users/dwiky/.pub-cache/hosted/pub.dev/cloud_firestore_web-3.8.2/ [ +7 ms] Found plugin device_info_plus at /Users/dwiky/.pub-cache/hosted/pub.dev/device_info_plus-9.1.2/ [ +5 ms] Found plugin file_picker at /Users/dwiky/.pub-cache/hosted/pub.dev/file_picker-6.1.1/ [ ] Found plugin file_selector_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.2/ [ ] Found plugin file_selector_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.3/ [ +1 ms] Found plugin file_selector_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3/ [ ] Found plugin firebase_analytics at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_analytics-10.6.2/ [ +1 ms] Found plugin firebase_analytics_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_analytics_web-0.5.5+4/ [ ] Found plugin firebase_app_installations at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_app_installations-0.2.4+2/ [ +1 ms] Found plugin firebase_app_installations_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_app_installations_web-0.1.3+10/ [ ] Found plugin firebase_core at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_core-2.20.0/ [ +1 ms] Found plugin firebase_core_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_core_web-2.10.0/ [ +2 ms] Found plugin firebase_messaging at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.2/ [ +1 ms] Found plugin firebase_messaging_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_messaging_web-3.5.11/ [ +1 ms] Found plugin firebase_remote_config at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_remote_config-4.3.2/ [ +2 ms] Found plugin firebase_remote_config_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_remote_config_web-1.4.10/ [ +3 ms] Found plugin flutter_config at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_config-2.0.2/ [ ] Found plugin flutter_exit_app at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_exit_app-1.1.2/ [ +1 ms] Found plugin flutter_keyboard_visibility at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility-6.0.0/ [ ] Found plugin flutter_keyboard_visibility_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_linux-1.0.0/ [ ] Found plugin flutter_keyboard_visibility_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_macos-1.0.0/ [ +1 ms] Found plugin flutter_keyboard_visibility_web at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_web-2.0.0/ [ ] Found plugin flutter_keyboard_visibility_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_windows-1.0.0/ [ +1 ms] Found plugin flutter_local_notifications at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_local_notifications-16.3.2/ [ +1 ms] Found plugin flutter_plugin_android_lifecycle at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.15/ [ +9 ms] Found plugin image_cropper at /Users/dwiky/.pub-cache/hosted/pub.dev/image_cropper-5.0.1/ [ ] Found plugin image_cropper_for_web at /Users/dwiky/.pub-cache/hosted/pub.dev/image_cropper_for_web-3.0.0/ [ ] Found plugin image_picker at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker-1.0.7/ [ ] Found plugin image_picker_android at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_android-0.8.9+3/ [ ] Found plugin image_picker_for_web at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_for_web-2.2.0/ [ ] Found plugin image_picker_ios at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.9+1/ [ ] Found plugin image_picker_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_linux-0.2.1/ [ ] Found plugin image_picker_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_macos-0.2.1/ [ ] Found plugin image_picker_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_windows-0.2.1/ [ +1 ms] Found plugin intercom_flutter at /Users/dwiky/.pub-cache/hosted/pub.dev/intercom_flutter-8.0.9/ [ ] Found plugin intercom_flutter_web at /Users/dwiky/.pub-cache/hosted/pub.dev/intercom_flutter_web-1.0.1/ [ +3 ms] Found plugin local_auth at /Users/dwiky/.pub-cache/hosted/pub.dev/local_auth-2.1.8/ [ ] Found plugin local_auth_android at /Users/dwiky/.pub-cache/hosted/pub.dev/local_auth_android-1.0.31/ [ ] Found plugin local_auth_ios at /Users/dwiky/.pub-cache/hosted/pub.dev/local_auth_ios-1.1.3/ [ ] Found plugin local_auth_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/local_auth_windows-1.0.8/ [ +2 ms] Found plugin mixpanel_flutter at /Users/dwiky/.pub-cache/hosted/pub.dev/mixpanel_flutter-2.2.0/ [ ] Found plugin mobile_scanner at /Users/dwiky/.pub-cache/hosted/pub.dev/mobile_scanner-3.5.2/ [ +2 ms] Found plugin package_info_plus at /Users/dwiky/.pub-cache/hosted/pub.dev/package_info_plus-5.0.1/ [ +1 ms] Found plugin path_provider at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider-2.1.2/ [ ] Found plugin path_provider_android at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider_android-2.2.2/ [ ] Found plugin path_provider_foundation at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/ [ ] Found plugin path_provider_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/ [ ] Found plugin path_provider_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/ [ +5 ms] Found plugin sentry_flutter at /Users/dwiky/.pub-cache/hosted/pub.dev/sentry_flutter-7.14.0/ [ ] Found plugin shared_preferences at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences-2.0.15/ [ ] Found plugin shared_preferences_android at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_android-2.0.11/ [ ] Found plugin shared_preferences_ios at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_ios-2.1.0/ [ ] Found plugin shared_preferences_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.1.0/ [ ] Found plugin shared_preferences_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_macos-2.0.3/ [ +1 ms] Found plugin shared_preferences_web at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_web-2.0.3/ [ ] Found plugin shared_preferences_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.1.0/ [ +4 ms] Found plugin sqflite at /Users/dwiky/.pub-cache/hosted/pub.dev/sqflite-2.0.2/ [ +3 ms] Found plugin syncfusion_flutter_pdfviewer at /Users/dwiky/.pub-cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-24.1.47/ [ ] Found plugin syncfusion_pdfviewer_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_macos-24.1.47/ [ +1 ms] Found plugin syncfusion_pdfviewer_web at /Users/dwiky/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_web-24.1.47/ [ ] Found plugin syncfusion_pdfviewer_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_windows-24.1.47/ [ +3 ms] Found plugin url_launcher at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher-6.2.4/ [ ] Found plugin url_launcher_android at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_android-6.2.2/ [ ] Found plugin url_launcher_ios at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.4/ [ ] Found plugin url_launcher_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_linux-3.1.1/ [ ] Found plugin url_launcher_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_macos-3.1.0/ [ ] Found plugin url_launcher_web at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_web-2.2.3/ [ ] Found plugin url_launcher_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.1/ [ +10 ms] Found plugin integration_test at /Users/dwiky/fvm/versions/3.16.7/packages/integration_test/ [ +12 ms] Found plugin convex_bottom_app_bar at /Users/dwiky/.pub-cache/git/convex_bottom_app_bar-8621a3ca8531e872998e8271006c395238520781/ [ +1 ms] Found plugin app_settings at /Users/dwiky/.pub-cache/hosted/pub.dev/app_settings-5.1.1/ [ +5 ms] Found plugin cloud_firestore at /Users/dwiky/.pub-cache/hosted/pub.dev/cloud_firestore-4.12.0/ [ ] Found plugin cloud_firestore_web at /Users/dwiky/.pub-cache/hosted/pub.dev/cloud_firestore_web-3.8.2/ [ +3 ms] Found plugin device_info_plus at /Users/dwiky/.pub-cache/hosted/pub.dev/device_info_plus-9.1.2/ [ +2 ms] Found plugin file_picker at /Users/dwiky/.pub-cache/hosted/pub.dev/file_picker-6.1.1/ [ ] Found plugin file_selector_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.2/ [ ] Found plugin file_selector_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.3/ [ ] Found plugin file_selector_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3/ [ ] Found plugin firebase_analytics at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_analytics-10.6.2/ [ ] Found plugin firebase_analytics_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_analytics_web-0.5.5+4/ [ ] Found plugin firebase_app_installations at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_app_installations-0.2.4+2/ [ ] Found plugin firebase_app_installations_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_app_installations_web-0.1.3+10/ [ ] Found plugin firebase_core at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_core-2.20.0/ [ ] Found plugin firebase_core_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_core_web-2.10.0/ [ ] Found plugin firebase_messaging at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.2/ [ ] Found plugin firebase_messaging_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_messaging_web-3.5.11/ [ ] Found plugin firebase_remote_config at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_remote_config-4.3.2/ [ ] Found plugin firebase_remote_config_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_remote_config_web-1.4.10/ [ +1 ms] Found plugin flutter_config at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_config-2.0.2/ [ ] Found plugin flutter_exit_app at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_exit_app-1.1.2/ [ ] Found plugin flutter_keyboard_visibility at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility-6.0.0/ [ ] Found plugin flutter_keyboard_visibility_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_linux-1.0.0/ [ ] Found plugin flutter_keyboard_visibility_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_macos-1.0.0/ [ ] Found plugin flutter_keyboard_visibility_web at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_web-2.0.0/ [ ] Found plugin flutter_keyboard_visibility_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_windows-1.0.0/ [ ] Found plugin flutter_local_notifications at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_local_notifications-16.3.2/ [ ] Found plugin flutter_plugin_android_lifecycle at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.15/ [ +4 ms] Found plugin image_cropper at /Users/dwiky/.pub-cache/hosted/pub.dev/image_cropper-5.0.1/ [ ] Found plugin image_cropper_for_web at /Users/dwiky/.pub-cache/hosted/pub.dev/image_cropper_for_web-3.0.0/ [ ] Found plugin image_picker at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker-1.0.7/ [ ] Found plugin image_picker_android at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_android-0.8.9+3/ [ ] Found plugin image_picker_for_web at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_for_web-2.2.0/ [ ] Found plugin image_picker_ios at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.9+1/ [ ] Found plugin image_picker_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_linux-0.2.1/ [ ] Found plugin image_picker_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_macos-0.2.1/ [ ] Found plugin image_picker_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_windows-0.2.1/ [ ] Found plugin intercom_flutter at /Users/dwiky/.pub-cache/hosted/pub.dev/intercom_flutter-8.0.9/ [ ] Found plugin intercom_flutter_web at /Users/dwiky/.pub-cache/hosted/pub.dev/intercom_flutter_web-1.0.1/ [ +1 ms] Found plugin local_auth at /Users/dwiky/.pub-cache/hosted/pub.dev/local_auth-2.1.8/ [ ] Found plugin local_auth_android at /Users/dwiky/.pub-cache/hosted/pub.dev/local_auth_android-1.0.31/ [ ] Found plugin local_auth_ios at /Users/dwiky/.pub-cache/hosted/pub.dev/local_auth_ios-1.1.3/ [ ] Found plugin local_auth_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/local_auth_windows-1.0.8/ [ +1 ms] Found plugin mixpanel_flutter at /Users/dwiky/.pub-cache/hosted/pub.dev/mixpanel_flutter-2.2.0/ [ ] Found plugin mobile_scanner at /Users/dwiky/.pub-cache/hosted/pub.dev/mobile_scanner-3.5.2/ [ +1 ms] Found plugin package_info_plus at /Users/dwiky/.pub-cache/hosted/pub.dev/package_info_plus-5.0.1/ [ ] Found plugin path_provider at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider-2.1.2/ [ ] Found plugin path_provider_android at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider_android-2.2.2/ [ ] Found plugin path_provider_foundation at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/ [ ] Found plugin path_provider_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/ [ ] Found plugin path_provider_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/ [ +2 ms] Found plugin sentry_flutter at /Users/dwiky/.pub-cache/hosted/pub.dev/sentry_flutter-7.14.0/ [ ] Found plugin shared_preferences at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences-2.0.15/ [ ] Found plugin shared_preferences_android at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_android-2.0.11/ [ ] Found plugin shared_preferences_ios at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_ios-2.1.0/ [ ] Found plugin shared_preferences_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.1.0/ [ ] Found plugin shared_preferences_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_macos-2.0.3/ [ ] Found plugin shared_preferences_web at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_web-2.0.3/ [ ] Found plugin shared_preferences_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.1.0/ [ +2 ms] Found plugin sqflite at /Users/dwiky/.pub-cache/hosted/pub.dev/sqflite-2.0.2/ [ +1 ms] Found plugin syncfusion_flutter_pdfviewer at /Users/dwiky/.pub-cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-24.1.47/ [ ] Found plugin syncfusion_pdfviewer_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_macos-24.1.47/ [ ] Found plugin syncfusion_pdfviewer_web at /Users/dwiky/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_web-24.1.47/ [ ] Found plugin syncfusion_pdfviewer_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_windows-24.1.47/ [ +1 ms] Found plugin url_launcher at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher-6.2.4/ [ ] Found plugin url_launcher_android at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_android-6.2.2/ [ ] Found plugin url_launcher_ios at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.4/ [ ] Found plugin url_launcher_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_linux-3.1.1/ [ ] Found plugin url_launcher_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_macos-3.1.0/ [ ] Found plugin url_launcher_web at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_web-2.2.3/ [ ] Found plugin url_launcher_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.1/ [ +5 ms] Found plugin integration_test at /Users/dwiky/fvm/versions/3.16.7/packages/integration_test/ [ +37 ms] Generating /Users/dwiky/StudioProjects/monit-mobile/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java [ +11 ms] executing: sysctl hw.optional.arm64 [ +2 ms] Exit code 0 from: sysctl hw.optional.arm64 [ ] hw.optional.arm64: 1 [ ] executing: /usr/bin/arch -arm64e xcrun xcodebuild -version [ +158 ms] Exit code 0 from: /usr/bin/arch -arm64e xcrun xcodebuild -version [ ] Xcode 15.2 Build version 15C500b [ +148 ms] Manifest contained wildcard assets. Inserting missing file into build graph to force rerun. for more information see #56466. [ +6 ms] running test package with arguments: [--no-color, --pause-after-load, -r, json, --plain-name, getCurrentUser from server, --chain-stack-traces, --, file:///Users/dwiky/StudioProjects/monit-mobile/test/features/auth/infrastructure/repositories/auth_repository_impl/getCurrentUser.welltested_test.dart?] [ +91 ms] test 0: starting test /Users/dwiky/StudioProjects/monit-mobile/test/features/auth/infrastructure/repositories/auth_repository_impl/getCurrentUser.welltested_test.dart [ +2 ms] Stopping scan for flutter_test_config.dart; found project root at /Users/dwiky/StudioProjects/monit-mobile [ +1 ms] Compiler will use the following file as its incremental dill file: /var/folders/dw/xflvpk657nb_56jx95n10mcm0000gn/T/flutter_tools.q62icO/flutter_test_compiler.XUS2xO/output.dill [ ] Listening to compiler controller... [ +3 ms] Compiling file:///var/folders/dw/xflvpk657nb_56jx95n10mcm0000gn/T/flutter_tools.q62icO/flutter_test_listener.hhZDUV/listener.dart [ +4 ms] Found plugin convex_bottom_app_bar at /Users/dwiky/.pub-cache/git/convex_bottom_app_bar-8621a3ca8531e872998e8271006c395238520781/ [ +2 ms] Found plugin app_settings at /Users/dwiky/.pub-cache/hosted/pub.dev/app_settings-5.1.1/ [ +5 ms] Found plugin cloud_firestore at /Users/dwiky/.pub-cache/hosted/pub.dev/cloud_firestore-4.12.0/ [ ] Found plugin cloud_firestore_web at /Users/dwiky/.pub-cache/hosted/pub.dev/cloud_firestore_web-3.8.2/ [ +3 ms] Found plugin device_info_plus at /Users/dwiky/.pub-cache/hosted/pub.dev/device_info_plus-9.1.2/ [ +3 ms] Found plugin file_picker at /Users/dwiky/.pub-cache/hosted/pub.dev/file_picker-6.1.1/ [ ] Found plugin file_selector_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.2/ [ ] Found plugin file_selector_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.3/ [ ] Found plugin file_selector_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3/ [ ] Found plugin firebase_analytics at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_analytics-10.6.2/ [ ] Found plugin firebase_analytics_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_analytics_web-0.5.5+4/ [ ] Found plugin firebase_app_installations at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_app_installations-0.2.4+2/ [ ] Found plugin firebase_app_installations_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_app_installations_web-0.1.3+10/ [ ] Found plugin firebase_core at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_core-2.20.0/ [ ] Found plugin firebase_core_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_core_web-2.10.0/ [ ] Found plugin firebase_messaging at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.2/ [ ] Found plugin firebase_messaging_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_messaging_web-3.5.11/ [ ] Found plugin firebase_remote_config at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_remote_config-4.3.2/ [ ] Found plugin firebase_remote_config_web at /Users/dwiky/.pub-cache/hosted/pub.dev/firebase_remote_config_web-1.4.10/ [ +1 ms] Found plugin flutter_config at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_config-2.0.2/ [ ] Found plugin flutter_exit_app at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_exit_app-1.1.2/ [ ] Found plugin flutter_keyboard_visibility at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility-6.0.0/ [ ] Found plugin flutter_keyboard_visibility_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_linux-1.0.0/ [ ] Found plugin flutter_keyboard_visibility_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_macos-1.0.0/ [ ] Found plugin flutter_keyboard_visibility_web at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_web-2.0.0/ [ ] Found plugin flutter_keyboard_visibility_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_windows-1.0.0/ [ ] Found plugin flutter_local_notifications at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_local_notifications-16.3.2/ [ ] Found plugin flutter_plugin_android_lifecycle at /Users/dwiky/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.15/ [ +4 ms] Found plugin image_cropper at /Users/dwiky/.pub-cache/hosted/pub.dev/image_cropper-5.0.1/ [ ] Found plugin image_cropper_for_web at /Users/dwiky/.pub-cache/hosted/pub.dev/image_cropper_for_web-3.0.0/ [ ] Found plugin image_picker at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker-1.0.7/ [ ] Found plugin image_picker_android at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_android-0.8.9+3/ [ ] Found plugin image_picker_for_web at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_for_web-2.2.0/ [ ] Found plugin image_picker_ios at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.9+1/ [ ] Found plugin image_picker_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_linux-0.2.1/ [ ] Found plugin image_picker_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_macos-0.2.1/ [ ] Found plugin image_picker_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/image_picker_windows-0.2.1/ [ ] Found plugin intercom_flutter at /Users/dwiky/.pub-cache/hosted/pub.dev/intercom_flutter-8.0.9/ [ ] Found plugin intercom_flutter_web at /Users/dwiky/.pub-cache/hosted/pub.dev/intercom_flutter_web-1.0.1/ [ +1 ms] Found plugin local_auth at /Users/dwiky/.pub-cache/hosted/pub.dev/local_auth-2.1.8/ [ ] Found plugin local_auth_android at /Users/dwiky/.pub-cache/hosted/pub.dev/local_auth_android-1.0.31/ [ ] Found plugin local_auth_ios at /Users/dwiky/.pub-cache/hosted/pub.dev/local_auth_ios-1.1.3/ [ ] Found plugin local_auth_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/local_auth_windows-1.0.8/ [ +1 ms] Found plugin mixpanel_flutter at /Users/dwiky/.pub-cache/hosted/pub.dev/mixpanel_flutter-2.2.0/ [ ] Found plugin mobile_scanner at /Users/dwiky/.pub-cache/hosted/pub.dev/mobile_scanner-3.5.2/ [ +1 ms] Found plugin package_info_plus at /Users/dwiky/.pub-cache/hosted/pub.dev/package_info_plus-5.0.1/ [ ] Found plugin path_provider at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider-2.1.2/ [ ] Found plugin path_provider_android at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider_android-2.2.2/ [ ] Found plugin path_provider_foundation at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/ [ ] Found plugin path_provider_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/ [ ] Found plugin path_provider_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/ [ +2 ms] Found plugin sentry_flutter at /Users/dwiky/.pub-cache/hosted/pub.dev/sentry_flutter-7.14.0/ [ ] Found plugin shared_preferences at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences-2.0.15/ [ ] Found plugin shared_preferences_android at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_android-2.0.11/ [ ] Found plugin shared_preferences_ios at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_ios-2.1.0/ [ ] Found plugin shared_preferences_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.1.0/ [ ] Found plugin shared_preferences_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_macos-2.0.3/ [ ] Found plugin shared_preferences_web at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_web-2.0.3/ [ ] Found plugin shared_preferences_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.1.0/ [ +2 ms] Found plugin sqflite at /Users/dwiky/.pub-cache/hosted/pub.dev/sqflite-2.0.2/ [ +1 ms] Found plugin syncfusion_flutter_pdfviewer at /Users/dwiky/.pub-cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-24.1.47/ [ ] Found plugin syncfusion_pdfviewer_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_macos-24.1.47/ [ ] Found plugin syncfusion_pdfviewer_web at /Users/dwiky/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_web-24.1.47/ [ ] Found plugin syncfusion_pdfviewer_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_windows-24.1.47/ [ +1 ms] Found plugin url_launcher at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher-6.2.4/ [ ] Found plugin url_launcher_android at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_android-6.2.2/ [ ] Found plugin url_launcher_ios at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.4/ [ ] Found plugin url_launcher_linux at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_linux-3.1.1/ [ ] Found plugin url_launcher_macos at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_macos-3.1.0/ [ ] Found plugin url_launcher_web at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_web-2.2.3/ [ ] Found plugin url_launcher_windows at /Users/dwiky/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.1/ [ +5 ms] Found plugin integration_test at /Users/dwiky/fvm/versions/3.16.7/packages/integration_test/ [ +11 ms] Writing native_assets.yaml. [ +5 ms] Writing /Users/dwiky/StudioProjects/monit-mobile/build/native_assets/macos/native_assets.yaml done. [ +1 ms] /Users/dwiky/fvm/versions/3.16.7/bin/cache/dart-sdk/bin/dart --disable-dart-dev /Users/dwiky/fvm/versions/3.16.7/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot --sdk-root /Users/dwiky/fvm/versions/3.16.7/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --no-print-incremental-dependencies --target=flutter --experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill /var/folders/dw/xflvpk657nb_56jx95n10mcm0000gn/T/flutter_tools.q62icO/flutter_test_compiler.XUS2xO/output.dill --packages /Users/dwiky/StudioProjects/monit-mobile/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --initialize-from-dill /Users/dwiky/StudioProjects/monit-mobile/build/test_cache/build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill --native-assets file:///Users/dwiky/StudioProjects/monit-mobile/build/native_assets/macos/native_assets.yaml --verbosity=error [ +8 ms] <- native-assets file:///Users/dwiky/StudioProjects/monit-mobile/build/native_assets/macos/native_assets.yaml [ ] <- compile file:///var/folders/dw/xflvpk657nb_56jx95n10mcm0000gn/T/flutter_tools.q62icO/flutter_test_listener.hhZDUV/listener.dart [+2000 ms] <- accept [ ] <- reset [ ] Compiling file:///var/folders/dw/xflvpk657nb_56jx95n10mcm0000gn/T/flutter_tools.q62icO/flutter_test_listener.hhZDUV/listener.dart took 2091ms [ ] test 0: starting test device [ +2 ms] test 0: awaiting connection to test device [ +3 ms] test 0: test harness socket server is running at port:52721 [ ] Using this directory for fonts configuration: /var/folders/dw/xflvpk657nb_56jx95n10mcm0000gn/T/flutter_tools.q62icO/flutter_test_fonts.GbbfJO [ ] test 0: Starting flutter_tester process with command=[/Users/dwiky/fvm/versions/3.16.7/bin/cache/artifacts/engine/darwin-x64/flutter_tester, --vm-service-port=0, --start-paused, --enable-checked-mode, --verify-entry-points, --enable-software-rendering, --skia-deterministic-rendering, --enable-dart-profiling, --non-interactive, --use-test-fonts, --disable-asset-fonts, --packages=/Users/dwiky/StudioProjects/monit-mobile/.dart_tool/package_config.json, --flutter-assets-dir=/Users/dwiky/StudioProjects/monit-mobile/build/unit_test_assets, /var/folders/dw/xflvpk657nb_56jx95n10mcm0000gn/T/flutter_tools.q62icO/flutter_test_listener.hhZDUV/listener.dart.dill], environment={FLUTTER_TEST: true, FONTCONFIG_FILE: /var/folders/dw/xflvpk657nb_56jx95n10mcm0000gn/T/flutter_tools.q62icO/flutter_test_fonts.GbbfJO/fonts.conf, SERVER_PORT: 52721, APP_NAME: monit_mobile, UNIT_TEST_ASSETS: /Users/dwiky/StudioProjects/monit-mobile/build/unit_test_assets} [ +4 ms] test 0: Started flutter_tester process at pid 25079 [ +125 ms] test 0: Shell: The Dart VM service is listening on http://127.0.0.1:52722/225_SnXrJL0=/ [ +1 ms] test 0: Starting Dart Development Service [ +560 ms] test 0: Dart Development Service started at http://127.0.0.1:52725/MtkpswFYtGs=/, forwarding to VM service at http://127.0.0.1:52722/225_SnXrJL0=/. [ ] Connecting to service protocol: http://127.0.0.1:52725/MtkpswFYtGs=/ [ +23 ms] test 0: Successfully connected to service protocol: http://127.0.0.1:52725/MtkpswFYtGs=/ [ ] test 0: VM Service uri is available at http://127.0.0.1:52725/MtkpswFYtGs=/ [ +407 ms] test 0: connected to test device, now awaiting test result [ ] test 0: Waiting for test harness or tests to finish Bad state: Cannot call `when` within a stub response package:mockito/src/mock.dart 1207:5 when test/features/auth/infrastructure/repositories/auth_repository_impl/getCurrentUser.welltested_test.dart 137:7 main.. Bad state: Cannot call `when` within a stub response package:mockito/src/mock.dart 1207:5 when test/features/auth/infrastructure/repositories/auth_repository_impl/getCurrentUser.welltested_test.dart 154:7 main.. Bad state: Cannot call `when` within a stub response package:mockito/src/mock.dart 1207:5 when test/features/auth/infrastructure/repositories/auth_repository_impl/getCurrentUser.welltested_test.dart 171:7 main.. [ +177 ms] test 0: Test harness is no longer needed by test process [ ] test 0: finished [ ] test 0: cleaning up... [ ] test 0: ensuring test device is terminated. [ ] test 0: Terminating flutter_tester process [ ] test 0: Shutting down DevTools server [ ] test 0: Test process is no longer needed by test harness [ ] test 0: Shutting down test harness socket server [ +6 ms] test 0: flutter_tester process at pid 25079 exited with code=-9 [ ] test 0: deleting temporary directory [ +1 ms] test 0: finished [ +1 ms] Deleting /var/folders/dw/xflvpk657nb_56jx95n10mcm0000gn/T/flutter_tools.q62icO/flutter_test_compiler.XUS2xO... [ +1 ms] killing pid 25073 [ +13 ms] Deleting /var/folders/dw/xflvpk657nb_56jx95n10mcm0000gn/T/flutter_tools.q62icO/flutter_test_fonts.GbbfJO... [ ] test package returned with exit code 1 [ ] Runtime for phase TestRunner: Wall-clock: 0:00:03.527245; combined: 0:00:03.527265. [ ] Runtime for phase Compile: Wall-clock: 0:00:02.091381; combined: 0:00:02.091399. [ ] Runtime for phase Run: Wall-clock: 0:00:01.306206; combined: 0:00:01.306216. [ ] Runtime for phase CoverageTotal: Wall-clock: 0:00:00.000000; combined: 0:00:00.000000. [ ] Runtime for phase CoverageCollect: Wall-clock: 0:00:00.000000; combined: 0:00:00.000000. [ ] Runtime for phase CoverageParseJson: Wall-clock: 0:00:00.000000; combined: 0:00:00.000000. [ ] Runtime for phase CoverageAddHitmap: Wall-clock: 0:00:00.000000; combined: 0:00:00.000000. [ ] Runtime for phase CoverageDataCollect: Wall-clock: 0:00:00.000000; combined: 0:00:00.000000. [ ] Runtime for phase WatcherFinishedTest: Wall-clock: 0:00:00.000245; combined: 0:00:00.000246. [ +3 ms] "flutter test" took 4,196ms. [ +1 ms] #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 TestCommand.runCommand (package:flutter_tools/src/commands/test.dart:519:7) #2 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1367:27) #3 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #4 CommandRunner.runCommand (package:args/command_runner.dart:212:13) #5 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:348:9) #6 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:294:5) #8 run.. (package:flutter_tools/runner.dart:112:9) #9 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #10 main (package:flutter_tools/executable.dart:90:3) [ ] Running 1 shutdown hook [ ] Shutdown hooks complete [ ] exiting with code 1 ```

https://github.com/dart-lang/mockito/assets/29680162/47b9a5bf-b713-426c-ac92-6c35dce37cce

srawlins commented 4 months ago

Sorry, it's impossible to debug this without the full source. I would try to experiment with commenting out various sets of tests. Maybe comment everything but the test on line 137. Comment all the tests after line 137. Comment everything out except two tests; maybe the test before 137 and the test on 137; maybe the test on 137 and the test after. You can also try throwing a fancy self-calling closure like thenThrow(() { print('throwing 1'); return ServerException(...); }()).

dwikyhardi commented 4 months ago

I still don't know what the problem but moving the test on line 97 to the bottom of the group fix the error. I think the problem is something to do with Intercom or maybe the way I create the mock or method I use for stubbing, but I'm still not sure

srawlins commented 4 months ago

😶 Wild! Very glad you moved past the issue. It may still speak to a bug in mockito, but at least you can hopefully move on with your work.

yanok commented 2 months ago

I still don't know what the problem but moving the test on line 97 to the bottom of the group fix the error. I think the problem is something to do with Intercom or maybe the way I create the mock or method I use for stubbing, but I'm still not sure

Well, of course it's about when(mockIntercom.updateUser(...)) call, there is the then{Return,Answer} part of it? ;) That's what keeps Mockito in the "setting a stub" state, where we don't allow more when calls.

A good question is how to detect this statically. But that's something to think about for the new API (there it won't be such a big problem anyway, since my plan is to get rid of this part of the global state).

yanok commented 2 months ago

Going to close this.