Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43d8d44e authored by Evan Laird's avatar Evan Laird Committed by Android (Google) Code Review
Browse files

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

parents 3a4bf0e5 c0d81e61
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -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]
+3 −5
Original line number Diff line number Diff line
@@ -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)
            }
            // No exception
        }

    @Test