Simplify error handling

This commit is contained in:
Kirill Kamakin
2022-04-05 15:32:57 +05:00
parent 21feea145a
commit eca325ebe4
11 changed files with 61 additions and 52 deletions

View File

@@ -71,7 +71,7 @@ class AuthDataSourceImplTest {
@Test(expected = MalformedUrl::class)
fun `when authenticate and provideService throws then MalformedUrl`() = runTest {
coEvery { authServiceFactory.provideService() } throws RuntimeException()
coEvery { authServiceFactory.provideService() } throws MalformedUrl(RuntimeException())
callAuthenticate()
}

View File

@@ -36,7 +36,9 @@ class VersionDataSourceImplTest {
@Test(expected = NetworkError.MalformedUrl::class)
fun `when getVersionInfo and provideService throws then MalformedUrl`() = runTest {
coEvery { versionServiceFactory.provideService(eq(TEST_BASE_URL)) } throws RuntimeException()
coEvery {
versionServiceFactory.provideService(eq(TEST_BASE_URL))
} throws NetworkError.MalformedUrl(RuntimeException())
subject.getVersionInfo(TEST_BASE_URL)
}