use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableBufferTest method bufferTimedExactBoundedError.
@SuppressWarnings("unchecked")
@Test
public void bufferTimedExactBoundedError() {
TestScheduler scheduler = new TestScheduler();
PublishProcessor<Integer> ps = PublishProcessor.create();
TestSubscriber<List<Integer>> to = ps.buffer(1, TimeUnit.MILLISECONDS, scheduler, 1, Functions.<Integer>createArrayList(16), true).test();
ps.onError(new TestException());
to.assertFailure(TestException.class);
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableBufferTest method bufferWithBOSourceThrows.
@Test
public void bufferWithBOSourceThrows() {
PublishProcessor<Integer> source = PublishProcessor.create();
PublishProcessor<Integer> boundary = PublishProcessor.create();
Subscriber<Object> o = TestHelper.mockSubscriber();
source.buffer(boundary).subscribe(o);
source.onNext(1);
source.onError(new TestException());
verify(o).onError(any(TestException.class));
verify(o, never()).onComplete();
verify(o, never()).onNext(any());
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableBufferTest method bufferWithStartEndEndThrows.
@Test
public void bufferWithStartEndEndThrows() {
PublishProcessor<Integer> start = PublishProcessor.create();
Function<Integer, Flowable<Integer>> end = new Function<Integer, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(Integer t1) {
return Flowable.error(new TestException());
}
};
PublishProcessor<Integer> source = PublishProcessor.create();
Flowable<List<Integer>> result = source.buffer(start, end);
Subscriber<Object> o = TestHelper.mockSubscriber();
result.subscribe(o);
start.onNext(1);
source.onNext(1);
source.onNext(2);
verify(o, never()).onNext(any());
verify(o, never()).onComplete();
verify(o).onError(any(TestException.class));
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableBufferTest method bufferWithBOBoundaryThrows.
@Test
public void bufferWithBOBoundaryThrows() {
PublishProcessor<Integer> source = PublishProcessor.create();
PublishProcessor<Integer> boundary = PublishProcessor.create();
Subscriber<Object> o = TestHelper.mockSubscriber();
source.buffer(boundary).subscribe(o);
source.onNext(1);
boundary.onError(new TestException());
verify(o).onError(any(TestException.class));
verify(o, never()).onComplete();
verify(o, never()).onNext(any());
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class CompletableCreateTest method onErrorThrows2.
@Test
public void onErrorThrows2() {
Completable.create(new CompletableOnSubscribe() {
@Override
public void subscribe(CompletableEmitter e) throws Exception {
try {
e.onError(new IOException());
fail("Should have thrown");
} catch (TestException ex) {
// expected
}
assertTrue(e.isDisposed());
}
}).subscribe(new CompletableObserver() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onError(Throwable e) {
throw new TestException();
}
@Override
public void onComplete() {
}
});
}
Aggregations