Merge "[Sb refactor] Remove throwing condition when requesting a repo" into udc-qpr-dev
This commit is contained in:
@@ -250,15 +250,8 @@ constructor(
|
|||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.onEach { logger.logDefaultMobileIconGroup(it) }
|
.onEach { logger.logDefaultMobileIconGroup(it) }
|
||||||
|
|
||||||
override fun getRepoForSubId(subId: Int): FullMobileConnectionRepository {
|
override fun getRepoForSubId(subId: Int): FullMobileConnectionRepository =
|
||||||
if (!isValidSubId(subId)) {
|
getOrCreateRepoForSubId(subId)
|
||||||
throw IllegalArgumentException(
|
|
||||||
"subscriptionId $subId is not in the list of valid subscriptions"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return getOrCreateRepoForSubId(subId)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getOrCreateRepoForSubId(subId: Int) =
|
private fun getOrCreateRepoForSubId(subId: Int) =
|
||||||
subIdRepositoryCache[subId]
|
subIdRepositoryCache[subId]
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ import kotlinx.coroutines.test.StandardTestDispatcher
|
|||||||
import kotlinx.coroutines.test.TestScope
|
import kotlinx.coroutines.test.TestScope
|
||||||
import kotlinx.coroutines.test.runCurrent
|
import kotlinx.coroutines.test.runCurrent
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Assert.assertThrows
|
|
||||||
import org.junit.Assert.assertTrue
|
import org.junit.Assert.assertTrue
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -588,11 +587,10 @@ class MobileConnectionsRepositoryTest : SysuiTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testConnectionRepository_invalidSubId_throws() =
|
fun testConnectionRepository_invalidSubId_doesNotThrow() =
|
||||||
testScope.runTest {
|
testScope.runTest {
|
||||||
assertThrows(IllegalArgumentException::class.java) {
|
|
||||||
underTest.getRepoForSubId(SUB_1_ID)
|
underTest.getRepoForSubId(SUB_1_ID)
|
||||||
}
|
// No exception
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user