From 6d8f71432bad90a3945d9ce93b17d2b75e0649f1 Mon Sep 17 00:00:00 2001 From: Vishwajith-Shettigar Date: Tue, 2 Jul 2024 09:04:43 +0530 Subject: [PATCH] Add kdoc and remove file from kdoc_validity_excemptions --- .../android/app/utility/ProtoExtraMatcher.kt | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/app/src/sharedTest/java/org/oppia/android/app/utility/ProtoExtraMatcher.kt b/app/src/sharedTest/java/org/oppia/android/app/utility/ProtoExtraMatcher.kt index 49af4253508..1b8a38154b6 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/utility/ProtoExtraMatcher.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/utility/ProtoExtraMatcher.kt @@ -10,18 +10,24 @@ import org.oppia.android.util.extensions.getProtoExtra /** A custom matcher to check if an Intent has a specific proto extra. */ class ProtoExtraMatcher { companion object { - fun hasProtoExtraCheck(keyName: String, expectedProto: T): - Matcher { - val defaultProto = expectedProto.newBuilderForType().build() - return object : TypeSafeMatcher() { - override fun describeTo(description: Description) { - description.appendText("Intent with extra: $keyName and proto value: $expectedProto") - } - override fun matchesSafely(intent: Intent): Boolean { - return intent.hasExtra(keyName) && - intent.getProtoExtra(keyName, defaultProto) == expectedProto - } + /** + * Returns a matcher that verifies if an Intent contains a specific proto extra. + * + * @param keyName The key name of the proto extra in the Intent. + * @param expectedProto The expected proto message to be matched. + */ + fun hasProtoExtraCheck(keyName: String, expectedProto: T): Matcher { + val defaultProto = expectedProto.newBuilderForType().build() + return object : TypeSafeMatcher() { + override fun describeTo(description: Description) { + description.appendText("Intent with extra: $keyName and proto value: $expectedProto") + } + + override fun matchesSafely(intent: Intent): Boolean { + return intent.hasExtra(keyName) && + intent.getProtoExtra(keyName, defaultProto) == expectedProto } } + } } }