Skip to content

[file_selector] Convert unit tests to Kotlin - #13102

Merged
auto-submit[bot] merged 8 commits into
flutter:mainfrom
stuartmorgan-g:file-selector-kotlin-tests
Nov 4, 2026
Merged

auto-submit[bot] merged 8 commits into
flutter:mainfrom
stuartmorgan-g:file-selector-kotlin-tests

Conversation

@stuartmorgan-g

Copy link
Copy Markdown
Contributor

Converts file_selector_android native unit tests from Java to Kotlin.

Similar to my other conversions, the process was:

  • Use the Android Studio deterministic auto-conversion.
  • Do manual cleanup and improvement as several separate commits.
    • This included adopting mockito-kotlin to make the mocking less verbose and complex
  • Do a local Gemini review for where the code could be improved as Kotlin code, and address most of that feedback.

Does not include any changes to production code.

Part of flutter/flutter#188630

Pre-Review Checklist

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

@stuartmorgan-g stuartmorgan-g 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 Oct 1, 2026
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Oct 1, 2026

@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 migrates the Android unit tests (FileSelectorAndroidPluginTest and FileUtilsTest) from Java to Kotlin, introduces the mockito-kotlin dependency, and removes the now-obsolete ResultCompat helper class. The feedback recommends replacing the double-bang (!!) operator with checkNotNull in several test assertions within FileSelectorAndroidPluginTest.kt to ensure proper null safety.

@mboetger mboetger 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.

nit: I think mockk is the generally preferred mocking framework for kotlin

@stuartmorgan stuartmorgan added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 4, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 4, 2026
@auto-submit

auto-submit Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/13102, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a member of flutter-hackers before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@stuartmorgan stuartmorgan added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 4, 2026
@auto-submit
auto-submit Bot merged commit cec8ebf into flutter:main Nov 4, 2026
13 checks passed
@bparrishMines

Copy link
Copy Markdown
Contributor

@stuartmorgan Are you converting the non-tests native code to Kotlin as well? I'm working on #13147 which deletes a lot of the code on Android if you don't mind waiting until that lands.

@stuartmorgan

Copy link
Copy Markdown
Contributor

I'm chipping away at conversions, but I'm not actively working on file_selector at the moment; this one I just missed having been approved. I'll make sure not to come back to the implementation code until things have settled.

bkonyi pushed a commit to bkonyi/flutter that referenced this pull request Nov 5, 2026
flutter/packages@670b30e...0478162

2026-11-05 [email protected] [material_ui] Document RefreshIndicator mouse
behavior on desktop and web (flutter/packages#13286)
2026-11-05 [email protected] [material_ui] Make
SearchAnchor.bar respect SearchBarThemeData padding
(flutter/packages#13360)
2026-11-04 [email protected] [pointer_interceptor] Use
dart.library.js_interop in example export (flutter/packages#13558)
2026-11-04 [email protected] [in_app_purchase_storekit] Use
purchase(confirmIn:) for StoreKit 2 purchases (flutter/packages#13410)
2026-11-04 [email protected] [material_ui] Fix
dismissal near minimum extent when shouldCloseOnMinExtent
(flutter/packages#12545)
2026-11-04 [email protected] [material_ui]
Add Material 3 Expressive `ElevatedButton` (flutter/packages#13084)
2026-11-04 [email protected] [go_router]
Stop inactive StatefulShellRoute branches from vetoing pops
(flutter/packages#12972)
2026-11-04 [email protected] Manual roll Flutter (stable)
from abaf9c5 to c197ca5 (14 revisions)
(flutter/packages#13542)
2026-11-04 [email protected] [in_app_purchase] Convert example app
to Swift (flutter/packages#13556)
2026-11-04 [email protected] Sync release-go_router-18.1.3 to
main (flutter/packages#13559)
2026-11-04 [email protected] Sync release-material_ui-1.10.0 to
main (flutter/packages#13546)
2026-11-04 [email protected]
[camera_android_camerax] Add magic number guideline to `TESTING.md`
(flutter/packages#13081)
2026-11-04 [email protected] Sync release-cupertino_ui-1.1.6 to
main (flutter/packages#13547)
2026-11-04 [email protected] [file_selector] Convert unit tests to
Kotlin (flutter/packages#13102)
2026-11-04 [email protected] Roll Flutter from
9347202 to 3623d2d (25 revisions) (flutter/packages#13555)

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: file_selector platform-android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants