Debian Codegraph @

src/test/java/io/reactivex/rxjava3/flowable/FlowableFuseableTest.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.flowable;
15
16 import java.util.Arrays;
17
18 import org.junit.Test;
19
20 import io.reactivex.rxjava3.core.*;
21 import io.reactivex.rxjava3.operators.QueueFuseable;
22 import io.reactivex.rxjava3.testsupport.TestHelper;
23
24 public class FlowableFuseableTest extends RxJavaTest {
25
26 @Test
27 public void syncRange() {
28
29 Flowable.range(1, 10)
30 .to(TestHelper.<Integer>testSubscriber(Long.MAX_VALUE, QueueFuseable.ANY, false))
31 .assertFusionMode(QueueFuseable.SYNC)
32 .assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
33 .assertNoErrors()
34 .assertComplete();
35 }
36
37 @Test
38 public void syncArray() {
39
40 Flowable.fromArray(new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 })
41 .to(TestHelper.<Integer>testSubscriber(Long.MAX_VALUE, QueueFuseable.ANY, false))
42 .assertFusionMode(QueueFuseable.SYNC)
43 .assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
44 .assertNoErrors()
45 .assertComplete();
46 }
47
48 @Test
49 public void syncIterable() {
50
51 Flowable.fromIterable(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
52 .to(TestHelper.<Integer>testSubscriber(Long.MAX_VALUE, QueueFuseable.ANY, false))
53 .assertFusionMode(QueueFuseable.SYNC)
54 .assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
55 .assertNoErrors()
56 .assertComplete();
57 }
58
59 @Test
60 public void syncRangeHidden() {
61
62 Flowable.range(1, 10).hide()
63 .to(TestHelper.<Integer>testSubscriber(Long.MAX_VALUE, QueueFuseable.ANY, false))
64 .assertNotFuseable()
65 .assertFusionMode(QueueFuseable.NONE)
66 .assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
67 .assertNoErrors()
68 .assertComplete();
69 }
70
71 @Test
72 public void syncArrayHidden() {
73 Flowable.fromArray(new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 })
74 .hide()
75 .to(TestHelper.<Integer>testSubscriber(Long.MAX_VALUE, QueueFuseable.ANY, false))
76 .assertNotFuseable()
77 .assertFusionMode(QueueFuseable.NONE)
78 .assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
79 .assertNoErrors()
80 .assertComplete();
81 }
82
83 @Test
84 public void syncIterableHidden() {
85 Flowable.fromIterable(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
86 .hide()
87 .to(TestHelper.<Integer>testSubscriber(Long.MAX_VALUE, QueueFuseable.ANY, false))
88 .assertNotFuseable()
89 .assertFusionMode(QueueFuseable.NONE)
90 .assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
91 .assertNoErrors()
92 .assertComplete();
93 }
94 }