@Override public Flowable<Object> apply(Flowable<? extends Throwable> t1) { return Flowable.empty(); } }).subscribe(ts);
@Test public void testDistinctUntilChangedOfNone() { Flowable<String> src = Flowable.empty(); src.distinctUntilChanged().subscribe(w); verify(w, never()).onNext(anyString()); verify(w, never()).onError(any(Throwable.class)); verify(w, times(1)).onComplete(); }
@Test public void testSkipEmptyStream() { Flowable<String> w = Flowable.empty(); Flowable<String> skip = w.skip(1); Subscriber<String> subscriber = TestHelper.mockSubscriber(); skip.subscribe(subscriber); verify(subscriber, never()).onNext(any(String.class)); verify(subscriber, never()).onError(any(Throwable.class)); verify(subscriber, times(1)).onComplete(); }
@Test public void testFirstOfNoneFlowable() { Flowable<Integer> flowable = Flowable.empty(); flowable.firstElement().toFlowable().subscribe(w); verify(w, never()).onNext(anyInt()); verify(w).onComplete(); verify(w, never()).onError(any(Throwable.class)); }
@Test public void testSingleOrDefaultWithEmpty() { Single<Integer> single = Flowable.<Integer> empty() .single(1); SingleObserver<Integer> observer = TestHelper.mockSingleObserver(); single.subscribe(observer); InOrder inOrder = inOrder(observer); inOrder.verify(observer, times(1)).onSuccess(1); inOrder.verifyNoMoreInteractions(); }
@Test public void testCompletePassThru() { Flowable<Integer> flowable = Flowable.empty(); Flowable<Integer> dematerialize = flowable.dematerialize(); Subscriber<Integer> subscriber = TestHelper.mockSubscriber(); TestSubscriber<Integer> ts = new TestSubscriber<Integer>(subscriber); dematerialize.subscribe(ts); System.out.println(ts.errors()); verify(subscriber, never()).onError(any(Throwable.class)); verify(subscriber, times(1)).onComplete(); verify(subscriber, times(0)).onNext(any(Integer.class)); }
@Test(timeout = 5000) public void mergeDelayErrorObservableEmpty() { Completable c = Completable.mergeDelayError(Flowable.<Completable>empty()); c.blockingAwait(); }
@SuppressWarnings("unchecked") @Test public void ambArrayEmpty() { assertSame(Flowable.empty(), Flowable.ambArray()); }
@Test public void blockingFirstDefault() { assertEquals(1, Flowable.<Integer>empty() .subscribeOn(Schedulers.computation()).blockingFirst(1).intValue()); }
@Test public void fromPublisherEmpty() { Completable.fromPublisher(Flowable.empty()) .test() .assertResult(); }
@Test public void scanEmptyBackpressured() { Flowable.<Integer>empty() .scan(0, SUM) .test(1) .assertResult(0); }
@Test public void timedEmptyOther() { Flowable.empty() .timeout(1, TimeUnit.DAYS, Flowable.just(1)) .test() .assertResult(); }
@Test public void testWithEmpty2Flowable() { Flowable<Boolean> flowable = Flowable.sequenceEqual( Flowable.just("one", "two", "three"), Flowable.<String> empty()).toFlowable(); verifyResult(flowable, false); }
@Test public void singleOrErrorNoElement() { Flowable.empty() .singleOrError() .test() .assertNoValues() .assertError(NoSuchElementException.class); }
@Test public void singleOrError() { Flowable.empty() .singleOrError() .toFlowable() .test() .assertFailure(NoSuchElementException.class); } }
@Test public void normalEmpty() { Flowable.empty() .doFinally(this) .test() .assertResult(); assertEquals(1, calls); }
@Test public void testEmptyObservable() { TestSubscriber<String> subscriber = TestSubscriber.create(); Single<String> single = Flowable.<String>empty().single(""); single.toFlowable().subscribe(subscriber); subscriber.assertResult(""); }
@Test public void empty() { Flowable.empty() .timeout(Functions.justFunction(Flowable.never())) .test() .assertResult(); }
@SuppressWarnings("unchecked") @Test public void emptyConditionalBackpressured() { TestSubscriber<Object> ts = new TestSubscriber<Object>(0L); Flowable.empty() .parallel(1) .runOn(ImmediateThinScheduler.INSTANCE) .filter(Functions.alwaysTrue()) .subscribe(new Subscriber[] { ts }); ts .assertResult(); }