docs(agents): Prefer Google Truth for new unit test assertions#5735
Merged
Conversation
Steer AI coding agents toward Google Truth's fluent assertThat API for assertions in new unit tests, while keeping kotlin.test for test structure. Truth is already a dependency in the sentry module; note that other modules need testImplementation(libs.google.truth) added before use. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
📲 Install BuildsAndroid
|
romtsn
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Adds guidance for AI coding agents to prefer Google Truth (
com.google.common.truth.Truth.assertThat) overkotlin.test/JUnit assertions when writing assertions in new unit tests, while continuing to usekotlin.testfor test structure (@Test,assertFailsWith).Updated files:
AGENTS.md— two bullets under Testing Requirements covering the preference, a pointer tosentry/src/test/java/io/sentry/DsnTest.ktas the reference style, and the per-moduletestImplementation(libs.google.truth)requirement..cursor/rules/coding.mdc— a concise version of the same guidance (this rule isalwaysApply: true).💡 Motivation and Context
Truth (v1.4.5) is already a dependency in the
sentrymodule and used inDsnTest.kt, but the rest of the repo useskotlin.test. This documents Truth as the preferred choice going forward so new tests get its more readable, fluent assertions. The guidance explicitly avoids churn by not rewriting existing assertions solely to switch libraries.💚 How did you test it?
Documentation-only change to agent instruction files. Ran
./gradlew spotlessApply apiDumpwith no resulting code changes.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
As modules gain Truth-based tests, add
testImplementation(libs.google.truth)to theirbuild.gradle.kts.#skip-changelog