Skip to content

Commit 6a985e0

Browse files
committed
Fix CommentSectionErrorTest to use named NetworkException for instrumented test compatibility
1 parent 501f4cc commit 6a985e0

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

app/src/androidTest/java/org/schabi/newpipe/ui/components/video/comments/CommentSectionErrorTest.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ class CommentSectionErrorTest {
2424
/**
2525
* Test Resource.Error state - when initial comment info loading fails
2626
*/
27+
class TestNetworkException : NetworkException("Connection attempt timed out", null) {
28+
override fun getErrorCode(): Int = NetworkException.ERROR_CONNECTION_TIMED_OUT
29+
override fun isImmediatelyRetryable() = true
30+
}
2731
@Test
2832
fun testResourceErrorState_ShowsUnableToLoadCommentsUiModel() {
2933

30-
val networkException = object : NetworkException("Connection attempt timed out", null) {
31-
override fun getErrorCode(): Int = NetworkException.ERROR_CONNECTION_TIMED_OUT
32-
override fun isImmediatelyRetryable() = true
33-
}
34+
val networkException = TestNetworkException()
3435
val errorResource = Resource.Error(networkException)
3536
assertEquals("Should contain the network exception", networkException, errorResource.throwable)
3637

0 commit comments

Comments
 (0)