Merge "[Sb refactor] Remove throwing condition when requesting a repo" into udc-qpr-dev am: 43d8d44eb7

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23750225

Change-Id: Ib43168d9f84d48a9685079752ae4e102bf5db349
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Evan Laird
2023-06-28 15:14:24 +00:00
committed by Automerger Merge Worker
2 changed files with 5 additions and 14 deletions

View File

@@ -250,15 +250,8 @@ constructor(
.distinctUntilChanged()
.onEach { logger.logDefaultMobileIconGroup(it) }
override fun getRepoForSubId(subId: Int): FullMobileConnectionRepository {
if (!isValidSubId(subId)) {
throw IllegalArgumentException(
"subscriptionId $subId is not in the list of valid subscriptions"
)
}
return getOrCreateRepoForSubId(subId)
}
override fun getRepoForSubId(subId: Int): FullMobileConnectionRepository =
getOrCreateRepoForSubId(subId)
private fun getOrCreateRepoForSubId(subId: Int) =
subIdRepositoryCache[subId]

View File

@@ -73,7 +73,6 @@ import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Assert.assertThrows
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
@@ -588,11 +587,10 @@ class MobileConnectionsRepositoryTest : SysuiTestCase() {
}
@Test
fun testConnectionRepository_invalidSubId_throws() =
fun testConnectionRepository_invalidSubId_doesNotThrow() =
testScope.runTest {
assertThrows(IllegalArgumentException::class.java) {
underTest.getRepoForSubId(SUB_1_ID)
}
underTest.getRepoForSubId(SUB_1_ID)
// No exception
}
@Test