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 } } + } } }