Skip to content

Commit 228f6d9

Browse files
RomanWuattierakarnokd
authored andcommitted
Have internal.operator.flowable unit tests extends RxJavaTest - 4 (#6600)
This commit updates the unit tests for `internal.operator.flowable` Related: #6583
1 parent e00c499 commit 228f6d9

File tree

150 files changed

+310
-1815
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+310
-1815
lines changed

src/test/java/io/reactivex/internal/operators/flowable/AbstractFlowableWithUpstreamTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515

1616
import static org.junit.Assert.assertSame;
1717

18+
import io.reactivex.RxJavaTest;
1819
import org.junit.Test;
1920

2021
import io.reactivex.Flowable;
2122
import io.reactivex.internal.functions.Functions;
2223
import io.reactivex.internal.fuseable.HasUpstreamPublisher;
2324

24-
public class AbstractFlowableWithUpstreamTest {
25+
public class AbstractFlowableWithUpstreamTest extends RxJavaTest {
2526

2627
@SuppressWarnings("unchecked")
2728
@Test

src/test/java/io/reactivex/internal/operators/flowable/BlockingFlowableLatestTest.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import io.reactivex.schedulers.TestScheduler;
2929
import io.reactivex.testsupport.TestHelper;
3030

31-
public class BlockingFlowableLatestTest {
32-
@Test(timeout = 1000)
31+
public class BlockingFlowableLatestTest extends RxJavaTest {
32+
@Test
3333
public void simple() {
3434
TestScheduler scheduler = new TestScheduler();
3535

@@ -53,7 +53,7 @@ public void simple() {
5353
Assert.assertFalse(it.hasNext());
5454
}
5555

56-
@Test(timeout = 1000)
56+
@Test
5757
public void sameSourceMultipleIterators() {
5858
TestScheduler scheduler = new TestScheduler();
5959

@@ -79,7 +79,7 @@ public void sameSourceMultipleIterators() {
7979
}
8080
}
8181

82-
@Test(timeout = 1000, expected = NoSuchElementException.class)
82+
@Test(expected = NoSuchElementException.class)
8383
public void empty() {
8484
Flowable<Long> source = Flowable.<Long> empty();
8585

@@ -92,7 +92,7 @@ public void empty() {
9292
it.next();
9393
}
9494

95-
@Test(timeout = 1000, expected = NoSuchElementException.class)
95+
@Test(expected = NoSuchElementException.class)
9696
public void simpleJustNext() {
9797
TestScheduler scheduler = new TestScheduler();
9898

@@ -111,7 +111,7 @@ public void simpleJustNext() {
111111
}
112112
}
113113

114-
@Test(/* timeout = 1000, */expected = RuntimeException.class)
114+
@Test(expected = RuntimeException.class)
115115
public void hasNextThrows() {
116116
TestScheduler scheduler = new TestScheduler();
117117

@@ -126,7 +126,7 @@ public void hasNextThrows() {
126126
it.hasNext();
127127
}
128128

129-
@Test(timeout = 1000, expected = RuntimeException.class)
129+
@Test(expected = RuntimeException.class)
130130
public void nextThrows() {
131131
TestScheduler scheduler = new TestScheduler();
132132

@@ -140,7 +140,7 @@ public void nextThrows() {
140140
it.next();
141141
}
142142

143-
@Test(timeout = 1000)
143+
@Test
144144
public void fasterSource() {
145145
PublishProcessor<Integer> source = PublishProcessor.create();
146146
Flowable<Integer> blocker = source;
@@ -169,12 +169,6 @@ public void fasterSource() {
169169
Assert.assertFalse(it.hasNext());
170170
}
171171

172-
@Ignore("THe target is an enum")
173-
@Test
174-
public void constructorshouldbeprivate() {
175-
TestHelper.checkUtilityClass(BlockingFlowableLatest.class);
176-
}
177-
178172
@Test(expected = UnsupportedOperationException.class)
179173
public void remove() {
180174
Flowable.never().blockingLatest().iterator().remove();

src/test/java/io/reactivex/internal/operators/flowable/BlockingFlowableMostRecentTest.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import io.reactivex.schedulers.TestScheduler;
2727
import io.reactivex.testsupport.TestHelper;
2828

29-
public class BlockingFlowableMostRecentTest {
29+
public class BlockingFlowableMostRecentTest extends RxJavaTest {
3030
@Test
3131
public void mostRecentNull() {
3232
assertNull(Flowable.<Void>never().blockingMostRecent(null).iterator().next());
@@ -73,7 +73,7 @@ public void mostRecentWithException() {
7373
it.next();
7474
}
7575

76-
@Test(timeout = 1000)
76+
@Test
7777
public void singleSourceManyIterators() {
7878
TestScheduler scheduler = new TestScheduler();
7979
Flowable<Long> source = Flowable.interval(1, TimeUnit.SECONDS, scheduler).take(10);
@@ -98,12 +98,6 @@ public void singleSourceManyIterators() {
9898

9999
}
100100

101-
@Ignore("The target is an enum")
102-
@Test
103-
public void constructorshouldbeprivate() {
104-
TestHelper.checkUtilityClass(BlockingFlowableMostRecent.class);
105-
}
106-
107101
@Test
108102
public void empty() {
109103
Iterator<Integer> it = Flowable.<Integer>empty()

src/test/java/io/reactivex/internal/operators/flowable/BlockingFlowableNextTest.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import io.reactivex.schedulers.Schedulers;
3333
import io.reactivex.testsupport.TestHelper;
3434

35-
public class BlockingFlowableNextTest {
35+
public class BlockingFlowableNextTest extends RxJavaTest {
3636

3737
private void fireOnNextInNewThread(final FlowableProcessor<String> o, final String value) {
3838
new Thread() {
@@ -307,7 +307,7 @@ public void run() {
307307
}
308308
}
309309

310-
@Test /* (timeout = 8000) */
310+
@Test
311311
public void singleSourceManyIterators() throws InterruptedException {
312312
Flowable<Long> f = Flowable.interval(250, TimeUnit.MILLISECONDS);
313313
PublishProcessor<Integer> terminal = PublishProcessor.create();
@@ -333,12 +333,6 @@ public void synchronousNext() {
333333
assertEquals(3, BehaviorProcessor.createDefault(3).blockingNext().iterator().next().intValue());
334334
}
335335

336-
@Ignore("THe target is an enum")
337-
@Test
338-
public void constructorshouldbeprivate() {
339-
TestHelper.checkUtilityClass(BlockingFlowableNext.class);
340-
}
341-
342336
@Test(expected = UnsupportedOperationException.class)
343337
public void remove() {
344338
Flowable.never().blockingNext().iterator().remove();

src/test/java/io/reactivex/internal/operators/flowable/BlockingFlowableToFutureTest.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.*;
2121
import java.util.concurrent.*;
2222

23+
import io.reactivex.testsupport.TestHelper;
2324
import org.junit.*;
2425
import org.reactivestreams.*;
2526

@@ -28,11 +29,6 @@
2829
import io.reactivex.internal.subscriptions.BooleanSubscription;
2930

3031
public class BlockingFlowableToFutureTest {
31-
@Ignore("No separate file")
32-
@Test
33-
public void constructorShouldBePrivate() {
34-
// TestHelper.checkUtilityClass(FlowableToFuture.class);
35-
}
3632

3733
@Test
3834
public void toFuture() throws InterruptedException, ExecutionException {
@@ -50,7 +46,7 @@ public void toFutureList() throws InterruptedException, ExecutionException {
5046
assertEquals("three", f.get().get(2));
5147
}
5248

53-
@Test(/* timeout = 5000, */expected = IndexOutOfBoundsException.class)
49+
@Test(expected = IndexOutOfBoundsException.class)
5450
public void exceptionWithMoreThanOneElement() throws Throwable {
5551
Flowable<String> obs = Flowable.just("one", "two");
5652
Future<String> f = obs.toFuture();
@@ -114,12 +110,4 @@ public void getWithEmptyFlowable() throws Throwable {
114110
throw e.getCause();
115111
}
116112
}
117-
118-
@Ignore("null value is not allowed")
119-
@Test
120-
public void getWithASingleNullItem() throws Exception {
121-
Flowable<String> obs = Flowable.just((String)null);
122-
Future<String> f = obs.toFuture();
123-
assertNull(f.get());
124-
}
125113
}

src/test/java/io/reactivex/internal/operators/flowable/BlockingFlowableToIteratorTest.java

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.util.*;
1919

20+
import io.reactivex.RxJavaTest;
2021
import org.junit.*;
2122
import org.reactivestreams.*;
2223

@@ -25,7 +26,7 @@
2526
import io.reactivex.internal.operators.flowable.BlockingFlowableIterable.BlockingFlowableIterator;
2627
import io.reactivex.internal.subscriptions.BooleanSubscription;
2728

28-
public class BlockingFlowableToIteratorTest {
29+
public class BlockingFlowableToIteratorTest extends RxJavaTest {
2930

3031
@Test
3132
public void toIterator() {
@@ -67,28 +68,6 @@ public void subscribe(Subscriber<? super String> subscriber) {
6768
it.next();
6869
}
6970

70-
@Ignore("subscribe() should not throw")
71-
@Test(expected = TestException.class)
72-
public void exceptionThrownFromOnSubscribe() {
73-
Iterable<String> strings = Flowable.unsafeCreate(new Publisher<String>() {
74-
@Override
75-
public void subscribe(Subscriber<? super String> subscriber) {
76-
throw new TestException("intentional");
77-
}
78-
}).blockingIterable();
79-
80-
for (String string : strings) {
81-
// never reaches here
82-
System.out.println(string);
83-
}
84-
}
85-
86-
@Ignore("This is not a separate class anymore")
87-
@Test
88-
public void constructorShouldBePrivate() {
89-
// TestHelper.checkUtilityClass(BlockingOperatorToIterator.class);
90-
}
91-
9271
@Test
9372
public void iteratorExertBackpressure() {
9473
final Counter src = new Counter();

src/test/java/io/reactivex/internal/operators/flowable/BufferUntilSubscriberTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.concurrent.*;
1818
import java.util.concurrent.atomic.*;
1919

20+
import io.reactivex.RxJavaTest;
2021
import org.junit.*;
2122
import org.reactivestreams.Publisher;
2223

@@ -25,7 +26,7 @@
2526
import io.reactivex.processors.PublishProcessor;
2627
import io.reactivex.schedulers.Schedulers;
2728

28-
public class BufferUntilSubscriberTest {
29+
public class BufferUntilSubscriberTest extends RxJavaTest {
2930

3031
@Test
3132
public void issue1677() throws InterruptedException {

src/test/java/io/reactivex/internal/operators/flowable/FlowableAllTest.java

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import io.reactivex.subscribers.TestSubscriber;
3434
import io.reactivex.testsupport.*;
3535

36-
public class FlowableAllTest {
36+
public class FlowableAllTest extends RxJavaTest {
3737

3838
@Test
3939
public void all() {
@@ -125,7 +125,7 @@ public boolean test(Integer i) {
125125
assertFalse(allOdd.blockingGet());
126126
}
127127

128-
@Test(timeout = 5000)
128+
@Test
129129
public void issue1935NoUnsubscribeDownstream() {
130130
Flowable<Integer> source = Flowable.just(1)
131131
.all(new Predicate<Integer>() {
@@ -144,22 +144,6 @@ public Publisher<Integer> apply(Boolean t1) {
144144
assertEquals((Object)2, source.blockingFirst());
145145
}
146146

147-
@Test
148-
@Ignore("No backpressure in Single")
149-
public void backpressureIfNoneRequestedNoneShouldBeDelivered() {
150-
TestObserver<Boolean> to = new TestObserver<Boolean>();
151-
Flowable.empty().all(new Predicate<Object>() {
152-
@Override
153-
public boolean test(Object t1) {
154-
return false;
155-
}
156-
}).subscribe(to);
157-
158-
to.assertNoValues();
159-
to.assertNoErrors();
160-
to.assertNotComplete();
161-
}
162-
163147
@Test
164148
public void backpressureIfOneRequestedOneShouldBeDelivered() {
165149
TestObserverEx<Boolean> to = new TestObserverEx<Boolean>();
@@ -299,7 +283,7 @@ public boolean test(Integer i) {
299283
assertFalse(allOdd.blockingFirst());
300284
}
301285

302-
@Test(timeout = 5000)
286+
@Test
303287
public void issue1935NoUnsubscribeDownstreamFlowable() {
304288
Flowable<Integer> source = Flowable.just(1)
305289
.all(new Predicate<Integer>() {

0 commit comments

Comments
 (0)