use of io.reactivex.rxjava3.core.Flowable in project RxJava by ReactiveX.
the class ParallelMapTest method conditionalCancelIgnored.
@Test
public void conditionalCancelIgnored() {
Flowable<Integer> f = new Flowable<Integer>() {
@Override
protected void subscribeActual(@NonNull Subscriber<@NonNull ? super @NonNull Integer> s) {
@SuppressWarnings("unchecked") ConditionalSubscriber<Integer> subscriber = (ConditionalSubscriber<Integer>) s;
subscriber.onSubscribe(new BooleanSubscription());
subscriber.tryOnNext(1);
subscriber.tryOnNext(2);
}
};
ParallelFlowable.fromArray(f).map(v -> {
throw new TestException();
}).filter(v -> true).sequential().test().assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.core.Flowable in project RxJava by ReactiveX.
the class ConnectableFlowable method connect.
/**
* Instructs the {@code ConnectableFlowable} to begin emitting the items from its underlying
* {@link Flowable} to its {@link Subscriber}s.
* <p>
* To disconnect from a synchronous source, use the {@link #connect(io.reactivex.rxjava3.functions.Consumer)} method.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>The behavior is determined by the implementor of this abstract class.</dd>
* </dl>
*
* @return the subscription representing the connection
* @see <a href="http://reactivex.io/documentation/operators/connect.html">ReactiveX documentation: Connect</a>
*/
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public final Disposable connect() {
ConnectConsumer cc = new ConnectConsumer();
connect(cc);
return cc.disposable;
}
use of io.reactivex.rxjava3.core.Flowable in project RxJava by ReactiveX.
the class BlockingFlowableLatestTest method hasNextThrows.
@Test(expected = RuntimeException.class)
public void hasNextThrows() {
TestScheduler scheduler = new TestScheduler();
Flowable<Long> source = Flowable.<Long>error(new RuntimeException("Forced failure!")).subscribeOn(scheduler);
Iterable<Long> iter = source.blockingLatest();
Iterator<Long> it = iter.iterator();
scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
it.hasNext();
}
use of io.reactivex.rxjava3.core.Flowable in project RxJava by ReactiveX.
the class BlockingFlowableLatestTest method simple.
@Test
public void simple() {
TestScheduler scheduler = new TestScheduler();
Flowable<Long> source = Flowable.interval(1, TimeUnit.SECONDS, scheduler).take(10);
Iterable<Long> iter = source.blockingLatest();
Iterator<Long> it = iter.iterator();
// which onComplete will overwrite the previous value
for (int i = 0; i < 9; i++) {
scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
Assert.assertTrue(it.hasNext());
Assert.assertEquals(Long.valueOf(i), it.next());
}
scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
Assert.assertFalse(it.hasNext());
}
use of io.reactivex.rxjava3.core.Flowable in project RxJava by ReactiveX.
the class BlockingFlowableLatestTest method simpleJustNext.
@Test(expected = NoSuchElementException.class)
public void simpleJustNext() {
TestScheduler scheduler = new TestScheduler();
Flowable<Long> source = Flowable.interval(1, TimeUnit.SECONDS, scheduler).take(10);
Iterable<Long> iter = source.blockingLatest();
Iterator<Long> it = iter.iterator();
// which onComplete will overwrite the previous value
for (int i = 0; i < 10; i++) {
scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
Assert.assertEquals(Long.valueOf(i), it.next());
}
}
Aggregations