1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-11-08 03:02:59 +00:00

Fix CommentSectionErrorTest to use named NetworkException for instrumented test compatibility

This commit is contained in:
Su TT
2025-07-03 14:25:36 -04:00
parent da4878d264
commit 19fb9899cd

View File

@@ -24,13 +24,14 @@ class CommentSectionErrorTest {
/**
* 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
fun testResourceErrorState_ShowsUnableToLoadCommentsUiModel() {
val networkException = object : NetworkException("Connection attempt timed out", null) {
override fun getErrorCode(): Int = NetworkException.ERROR_CONNECTION_TIMED_OUT
override fun isImmediatelyRetryable() = true
}
val networkException = TestNetworkException()
val errorResource = Resource.Error(networkException)
assertEquals("Should contain the network exception", networkException, errorResource.throwable)