Skip to content

[shared_prferences] Adopts mockito-kotlin in tests - #13624

Merged
auto-submit[bot] merged 2 commits into
flutter:mainfrom
stuartmorgan:shared-prefs-android-test-streamlining
Nov 11, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:mainfrom
stuartmorgan:shared-prefs-android-test-streamlining

Conversation

@stuartmorgan

Copy link
Copy Markdown
Contributor

Adopts the mockito-kotlin library that has been used in other plugins' test conversions, which simplifies interacting with Mockito in Kotlin code, reducing some unnecessary test boilerplate.

Adopts the `mockito-kotlin` library that has been used in other plugins'
test conversions, which simplifies interacting with Mockito in Kotlin
code, reducing some unnecessary test boilerplate.
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Nov 11, 2026
@stuartmorgan stuartmorgan added override: no versioning needed Override the check requiring version bumps for most changes override: no changelog needed Override the check requiring CHANGELOG updates for most changes labels Nov 11, 2026
@stuartmorgan

Copy link
Copy Markdown
Contributor Author

version/changelog override: the gradle change here is test-only.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds the mockito-kotlin dependency to the Android build configuration and refactors LegacySharedPreferencesTest.kt to utilize Kotlin-friendly Mockito APIs (such as mock, whenever, and verify) instead of standard Java Mockito syntax. The reviewer recommended removing the redundant mockito-inline dependency, as Mockito 5.x enables the inline mock maker by default and mockito-kotlin transitively includes mockito-core 5.x.

/** A dummy implementation for tests for use with FakeSharedPreferences */
private class FakeSharedPreferencesEditor
constructor(private val sharedPrefData: MutableMap<String, Any?>) : SharedPreferences.Editor {
private class FakeSharedPreferencesEditor(private val sharedPrefData: MutableMap<String, Any?>) :

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a stray IDE warning fix while I was in the IDE; constructor is redundant here.

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 11, 2026
@auto-submit
auto-submit Bot merged commit 6c71b07 into flutter:main Nov 11, 2026
13 checks passed
@stuartmorgan
stuartmorgan deleted the shared-prefs-android-test-streamlining branch November 11, 2026 21:59
b-luk pushed a commit to b-luk/flutter that referenced this pull request Nov 12, 2026
…r#196450)

flutter/packages@653628e...14f9933

2026-11-12 [email protected] [material_ui]
Fix SnackBarThemeData.lerp dropping showCloseIcon
(flutter/packages#13449)
2026-11-11 [email protected] [ci] Update repo
for 3.50 stable release (flutter/packages#13628)
2026-11-11 [email protected] [vector_graphics]
Use font-family lists as a family with fallbacks
(flutter/packages#13552)
2026-11-11 [email protected] Roll Flutter (stable) from
c197ca5 to ab29120 (1647 revisions) (flutter/packages#13625)
2026-11-11 [email protected] [shared_prferences] Adopts
mockito-kotlin in tests (flutter/packages#13624)
2026-11-11 [email protected] [cupertino_ui] Dim disabled
CupertinoSlider controls (flutter/packages#13419)
2026-11-11 [email protected] [flutter_svg] Invalidate pending cache
entries on clear and evict (flutter/packages#13595)
2026-11-11 [email protected] [cupertino_ui] Fix the tinted
button's fill opacity (flutter/packages#13436)
2026-11-11 [email protected] [various]
Support SVG filters (blur, offset, feMerge) (flutter/packages#11909)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD override: no changelog needed Override the check requiring CHANGELOG updates for most changes override: no versioning needed Override the check requiring version bumps for most changes p: shared_preferences platform-android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants