Skip to content

[shared_preferences] Convert legacy tests to Kotlin#12193

Open
stuartmorgan-g wants to merge 11 commits into
flutter:mainfrom
stuartmorgan-g:shared-prefs-legacy-tests-kotlin
Open

[shared_preferences] Convert legacy tests to Kotlin#12193
stuartmorgan-g wants to merge 11 commits into
flutter:mainfrom
stuartmorgan-g:shared-prefs-legacy-tests-kotlin

Conversation

@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

Converts the legacy tests for shared_preferences_android to Kotlin, so that the plugin is now consistently using Kotlin, instead of a mix of Java and Kotlin.

As with the non-test PR, this was a first-pass conversion via the Android Studio auto-converted, followed by manual fixup, followed by running it through a local Gemini review focusing on making the Kotlin more idiomatic.

Follow-up to #12139
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

@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 LegacySharedPreferencesTest class from Java to Kotlin. The review feedback suggests removing redundant @Mock annotations, as the mocks are already manually initialized in the setup method, and correcting the argument order in several assertEquals assertions where the expected and actual values are swapped.

stuartmorgan-g and others added 2 commits July 13, 2026 13:20
…/src/test/kotlin/io/flutter/plugins/sharedpreferences/LegacySharedPreferencesTest.kt

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…/src/test/kotlin/io/flutter/plugins/sharedpreferences/LegacySharedPreferencesTest.kt

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@github-actions github-actions Bot removed the CICD Run CI/CD label Jul 13, 2026
@stuartmorgan-g stuartmorgan-g added the CICD Run CI/CD label Jul 13, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Jul 13, 2026
@stuartmorgan-g stuartmorgan-g added the CICD Run CI/CD label Jul 13, 2026
val flutterData: Map<String, Any> = plugin.getAll("flutter.", null)

assertEquals(5, flutterData.size)
assertEquals("Java", flutterData["flutter.Language"])

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.

lol

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

lg, might be worth changing all the "java" to "kotlin" but it doesn't really matter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants