Following up from https://github.com/flutter/packages/pull/12635, this converts the unit tests from Java to Kotlin. As with that PR, this started with a deterministic Android Studio conversion, then made follow-up fixes manually, including suggestions from a local Gemini review.
The non-test changes are to replace `@VisibleForTesting` with `internal` now that the tests are Kotlin and can therefore access `internal` members. (Also, one very minor refactoring to fix a code suggestion warning in Android Studio.)
Part of https://github.com/flutter/flutter/issues/188630
## Pre-Review Checklist
[^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.