mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-11-10 04:02:59 +00:00
Fix CommentSectionErrorTest to use named NetworkException for instrumented test compatibility
This commit is contained in:
@@ -24,13 +24,14 @@ class CommentSectionErrorTest {
|
|||||||
/**
|
/**
|
||||||
* Test Resource.Error state - when initial comment info loading fails
|
* Test Resource.Error state - when initial comment info loading fails
|
||||||
*/
|
*/
|
||||||
|
class TestNetworkException : NetworkException("Connection attempt timed out", null) {
|
||||||
|
override fun getErrorCode(): Int = NetworkException.ERROR_CONNECTION_TIMED_OUT
|
||||||
|
override fun isImmediatelyRetryable() = true
|
||||||
|
}
|
||||||
@Test
|
@Test
|
||||||
fun testResourceErrorState_ShowsUnableToLoadCommentsUiModel() {
|
fun testResourceErrorState_ShowsUnableToLoadCommentsUiModel() {
|
||||||
|
|
||||||
val networkException = object : NetworkException("Connection attempt timed out", null) {
|
val networkException = TestNetworkException()
|
||||||
override fun getErrorCode(): Int = NetworkException.ERROR_CONNECTION_TIMED_OUT
|
|
||||||
override fun isImmediatelyRetryable() = true
|
|
||||||
}
|
|
||||||
val errorResource = Resource.Error(networkException)
|
val errorResource = Resource.Error(networkException)
|
||||||
assertEquals("Should contain the network exception", networkException, errorResource.throwable)
|
assertEquals("Should contain the network exception", networkException, errorResource.throwable)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user