|
4 | 4 |
|
5 | 5 | package kotlinx.coroutines.rx3
|
6 | 6 |
|
7 |
| -import io.reactivex.rxjava3.core.* |
8 |
| -import io.reactivex.rxjava3.exceptions.* |
9 | 7 | import kotlinx.coroutines.*
|
10 | 8 | import kotlinx.coroutines.CancellationException
|
11 | 9 | import org.junit.*
|
12 | 10 | import org.junit.Test
|
13 |
| -import java.util.concurrent.* |
14 |
| -import java.util.concurrent.atomic.* |
15 | 11 | import kotlin.test.*
|
16 | 12 |
|
17 | 13 | class ObservableTest : TestBase() {
|
@@ -138,30 +134,4 @@ class ObservableTest : TestBase() {
|
138 | 134 | expect(4)
|
139 | 135 | }
|
140 | 136 | }
|
141 |
| - |
142 |
| - @Test |
143 |
| - fun testExceptionAfterCancellation() { |
144 |
| - // Test that no exceptions were reported to the coroutine EH (it will fail the test if so) |
145 |
| - val coroutineExceptionHandler = CoroutineExceptionHandler { _, _ -> expectUnreached() } |
146 |
| - val rxExceptionHandlerInvocations = AtomicInteger() |
147 |
| - val rxExceptionHandler: (Throwable) -> Unit = { error -> |
148 |
| - assertTrue(error is UndeliverableException) |
149 |
| - assertTrue(error.cause is TestException) |
150 |
| - rxExceptionHandlerInvocations.getAndIncrement() |
151 |
| - } |
152 |
| - withExceptionHandler(rxExceptionHandler) { |
153 |
| - Observable |
154 |
| - .interval(1, TimeUnit.MILLISECONDS) |
155 |
| - .take(1000) |
156 |
| - .switchMapSingle { |
157 |
| - rxSingle(coroutineExceptionHandler) { |
158 |
| - timeBomb().await() |
159 |
| - } |
160 |
| - } |
161 |
| - .blockingSubscribe({}, {}) |
162 |
| - } |
163 |
| - assertTrue(rxExceptionHandlerInvocations.get() > 0) |
164 |
| - } |
165 |
| - |
166 |
| - private fun timeBomb() = Single.timer(1, TimeUnit.MILLISECONDS).doOnSuccess { throw TestException() } |
167 | 137 | }
|
0 commit comments