Merge "Filter out empty phone number" into main

This commit is contained in:
Chaohui Wang
2024-03-15 03:08:16 +00:00
committed by Android (Google) Code Review
2 changed files with 19 additions and 1 deletions

View File

@@ -141,10 +141,27 @@ class SubscriptionRepositoryTest {
assertThat(subInfos.map { it.subscriptionId }).containsExactly(SUB_ID_1)
}
@Test
fun phoneNumberFlow() = runBlocking {
mockSubscriptionManager.stub {
on { getPhoneNumber(SUB_ID_1) } doReturn NUMBER_1
}
val subInfo = SubscriptionInfo.Builder().apply {
setId(SUB_ID_1)
setMcc(MCC)
}.build()
val phoneNumber = context.phoneNumberFlow(subInfo).firstWithTimeoutOrNull()
assertThat(phoneNumber).isEqualTo(NUMBER_1)
}
private companion object {
const val SUB_ID_1 = 1
const val SUB_ID_2 = 2
val GROUP_UUID = UUID.randomUUID().toString()
const val SIM_SLOT_INDEX = 1
const val NUMBER_1 = "000000001"
const val MCC = "310"
}
}