Updated on 2026-08-14
This commit is contained in:
parent
f77389cd31
commit
863d12763d
4 changed files with 58 additions and 19 deletions
|
|
@ -5,6 +5,7 @@ import com.squareup.moshi.JsonAdapter
|
|||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.Types
|
||||
import com.squareup.moshi.adapter
|
||||
import com.tangem.core.analytics.api.AnalyticsExceptionHandler
|
||||
import com.tangem.datasource.api.express.models.response.Asset
|
||||
import com.tangem.datasource.asset.reader.AssetReader
|
||||
import com.tangem.utils.coroutines.TestingCoroutineDispatcherProvider
|
||||
|
|
@ -23,9 +24,11 @@ class AssetLoaderTest {
|
|||
|
||||
private val assetReader = mockk<AssetReader>()
|
||||
private val moshi = mockk<Moshi>()
|
||||
private val analyticsExceptionHandler = mockk<AnalyticsExceptionHandler>()
|
||||
private val assetLoader = AssetLoader(
|
||||
assetReader = assetReader,
|
||||
moshi = moshi,
|
||||
analyticsExceptionHandler = analyticsExceptionHandler,
|
||||
dispatchers = TestingCoroutineDispatcherProvider(),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ internal class AndroidAssetReaderTest {
|
|||
|
||||
@Test
|
||||
fun read_content() = runTest {
|
||||
every { assetManager.open(FILE_NAME) } returns json.byteInputStream()
|
||||
every { assetManager.open(FILE_NAME, AssetManager.ACCESS_BUFFER) } returns json.byteInputStream()
|
||||
|
||||
val actual = assetReader.read(fullFileName = FILE_NAME)
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ internal class AndroidAssetReaderTest {
|
|||
@Test
|
||||
fun read_error() = runTest {
|
||||
val exception = IOException("Error")
|
||||
every { assetManager.open(FILE_NAME) } throws exception
|
||||
every { assetManager.open(FILE_NAME, AssetManager.ACCESS_BUFFER) } throws exception
|
||||
|
||||
runCatching { assetReader.read(fullFileName = FILE_NAME) }
|
||||
.onSuccess { throw IllegalStateException("Error should be thrown") }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue