|
15 | 15 |
|
16 | 16 | import static org.junit.Assert.assertEquals;
|
17 | 17 |
|
18 |
| -import java.util.concurrent.TimeUnit; |
| 18 | +import java.util.concurrent.*; |
19 | 19 | import java.util.concurrent.atomic.AtomicInteger;
|
20 | 20 |
|
21 | 21 | import org.junit.Test;
|
22 | 22 | import org.reactivestreams.Publisher;
|
23 | 23 |
|
24 | 24 | import io.reactivex.*;
|
25 |
| -import io.reactivex.exceptions.TestException; |
| 25 | +import io.reactivex.exceptions.*; |
26 | 26 | import io.reactivex.functions.*;
|
27 | 27 | import io.reactivex.internal.operators.flowable.FlowableConcatMap.WeakScalarSubscription;
|
28 | 28 | import io.reactivex.schedulers.Schedulers;
|
@@ -169,4 +169,42 @@ public void run() throws Exception {
|
169 | 169 |
|
170 | 170 | assertEquals(0, counter.get());
|
171 | 171 | }
|
| 172 | + |
| 173 | + @Test |
| 174 | + public void delayErrorCallableTillTheEnd() { |
| 175 | + Flowable.just(1, 2, 3, 101, 102, 23, 890, 120, 32) |
| 176 | + .concatMapDelayError(new Function<Integer, Flowable<Integer>>() { |
| 177 | + @Override public Flowable<Integer> apply(final Integer integer) throws Exception { |
| 178 | + return Flowable.fromCallable(new Callable<Integer>() { |
| 179 | + @Override public Integer call() throws Exception { |
| 180 | + if (integer >= 100) { |
| 181 | + throw new NullPointerException("test null exp"); |
| 182 | + } |
| 183 | + return integer; |
| 184 | + } |
| 185 | + }); |
| 186 | + } |
| 187 | + }) |
| 188 | + .test() |
| 189 | + .assertFailure(CompositeException.class, 1, 2, 3, 23, 32); |
| 190 | + } |
| 191 | + |
| 192 | + @Test |
| 193 | + public void delayErrorCallableEager() { |
| 194 | + Flowable.just(1, 2, 3, 101, 102, 23, 890, 120, 32) |
| 195 | + .concatMapDelayError(new Function<Integer, Flowable<Integer>>() { |
| 196 | + @Override public Flowable<Integer> apply(final Integer integer) throws Exception { |
| 197 | + return Flowable.fromCallable(new Callable<Integer>() { |
| 198 | + @Override public Integer call() throws Exception { |
| 199 | + if (integer >= 100) { |
| 200 | + throw new NullPointerException("test null exp"); |
| 201 | + } |
| 202 | + return integer; |
| 203 | + } |
| 204 | + }); |
| 205 | + } |
| 206 | + }, 2, false) |
| 207 | + .test() |
| 208 | + .assertFailure(NullPointerException.class, 1, 2, 3); |
| 209 | + } |
172 | 210 | }
|
0 commit comments