Debian Codegraph @

src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableConcatDelayErrorTest.java

raw
1 /*
2 * Copyright (c) 2016-present, RxJava Contributors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
5 * compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License is
10 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
11 * the License for the specific language governing permissions and limitations under the License.
12 */
13
14 package io.reactivex.rxjava3.internal.operators.completable;
15
16 import static org.mockito.Mockito.*;
17
18 import java.util.Arrays;
19
20 import org.junit.Test;
21
22 import io.reactivex.rxjava3.core.*;
23 import io.reactivex.rxjava3.exceptions.TestException;
24 import io.reactivex.rxjava3.functions.Action;
25
26 public class CompletableConcatDelayErrorTest {
27
28 @Test
29 public void normalIterable() throws Throwable {
30 Action action1 = mock(Action.class);
31 Action action2 = mock(Action.class);
32
33 Completable.concatDelayError(Arrays.asList(
34 Completable.fromAction(action1),
35 Completable.error(new TestException()),
36 Completable.fromAction(action2)
37 ))
38 .test()
39 .assertFailure(TestException.class);
40
41 verify(action1).run();
42
43 verify(action2).run();
44 }
45
46 @Test
47 public void normalPublisher() throws Throwable {
48 Action action1 = mock(Action.class);
49 Action action2 = mock(Action.class);
50
51 Completable.concatDelayError(Flowable.fromArray(
52 Completable.fromAction(action1),
53 Completable.error(new TestException()),
54 Completable.fromAction(action2)
55 ))
56 .test()
57 .assertFailure(TestException.class);
58
59 verify(action1).run();
60
61 verify(action2).run();
62 }
63
64 @Test
65 public void normalPublisherPrefetch() throws Throwable {
66 Action action1 = mock(Action.class);
67 Action action2 = mock(Action.class);
68
69 Completable.concatDelayError(Flowable.fromArray(
70 Completable.fromAction(action1),
71 Completable.error(new TestException()),
72 Completable.fromAction(action2)
73 ), 1)
74 .test()
75 .assertFailure(TestException.class);
76
77 verify(action1).run();
78
79 verify(action2).run();
80 }
81
82 }