Debian Codegraph @

src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatEagerTest.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.maybe;
15
16 import java.util.Arrays;
17
18 import org.junit.Test;
19
20 import io.reactivex.rxjava3.core.*;
21 import io.reactivex.rxjava3.exceptions.TestException;
22
23 public class MaybeConcatEagerTest {
24
25 @Test
26 public void iterableNormal() {
27 Maybe.concatEager(Arrays.asList(
28 Maybe.just(1),
29 Maybe.empty(),
30 Maybe.just(2)
31 ))
32 .test()
33 .assertResult(1, 2);
34 }
35
36 @Test
37 public void iterableNormalMaxConcurrency() {
38 Maybe.concatEager(Arrays.asList(
39 Maybe.just(1),
40 Maybe.empty(),
41 Maybe.just(2)
42 ), 1)
43 .test()
44 .assertResult(1, 2);
45 }
46
47 @Test
48 public void iterableError() {
49 Maybe.concatEager(Arrays.asList(
50 Maybe.just(1),
51 Maybe.error(new TestException()),
52 Maybe.empty(),
53 Maybe.just(2)
54 ))
55 .test()
56 .assertFailure(TestException.class, 1);
57 }
58
59 @Test
60 public void iterableErrorMaxConcurrency() {
61 Maybe.concatEager(Arrays.asList(
62 Maybe.just(1),
63 Maybe.error(new TestException()),
64 Maybe.empty(),
65 Maybe.just(2)
66 ), 1)
67 .test()
68 .assertFailure(TestException.class, 1);
69 }
70
71 @Test
72 public void publisherNormal() {
73 Maybe.concatEager(Flowable.fromArray(
74 Maybe.just(1),
75 Maybe.empty(),
76 Maybe.just(2)
77 ))
78 .test()
79 .assertResult(1, 2);
80 }
81
82 @Test
83 public void publisherNormalMaxConcurrency() {
84 Maybe.concatEager(Flowable.fromArray(
85 Maybe.just(1),
86 Maybe.empty(),
87 Maybe.just(2)
88 ), 1)
89 .test()
90 .assertResult(1, 2);
91 }
92
93 @Test
94 public void publisherError() {
95 Maybe.concatEager(Flowable.fromArray(
96 Maybe.just(1),
97 Maybe.error(new TestException()),
98 Maybe.empty(),
99 Maybe.just(2)
100 ))
101 .test()
102 .assertFailure(TestException.class, 1);
103 }
104
105 @Test
106 public void iterableDelayError() {
107 Maybe.concatEagerDelayError(Arrays.asList(
108 Maybe.just(1),
109 Maybe.error(new TestException()),
110 Maybe.empty(),
111 Maybe.just(2)
112 ))
113 .test()
114 .assertFailure(TestException.class, 1, 2);
115 }
116
117 @Test
118 public void iterableDelayErrorMaxConcurrency() {
119 Maybe.concatEagerDelayError(Arrays.asList(
120 Maybe.just(1),
121 Maybe.error(new TestException()),
122 Maybe.empty(),
123 Maybe.just(2)
124 ), 1)
125 .test()
126 .assertFailure(TestException.class, 1, 2);
127 }
128
129 @Test
130 public void publisherDelayError() {
131 Maybe.concatEagerDelayError(Flowable.fromArray(
132 Maybe.just(1),
133 Maybe.error(new TestException()),
134 Maybe.empty(),
135 Maybe.just(2)
136 ))
137 .test()
138 .assertFailure(TestException.class, 1, 2);
139 }
140
141 @Test
142 public void publisherDelayErrorMaxConcurrency() {
143 Maybe.concatEagerDelayError(Flowable.fromArray(
144 Maybe.just(1),
145 Maybe.error(new TestException()),
146 Maybe.empty(),
147 Maybe.just(2)
148 ), 1)
149 .test()
150 .assertFailure(TestException.class, 1, 2);
151 }
152 }