Debian Codegraph @

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