@Override public CompletableSource apply(Object v) throws Exception { return Completable.never(); } }, new Consumer<Object>() {
@Override public CompletableSource apply(Object v) throws Exception { return Completable.never(); } }, new Consumer<Object>() {
@Override public Completable apply(Flowable<Flowable<Completable>> v) throws Exception { return Completable.never(); } }, Schedulers.single());
@Override public CompletableSource apply(Object v) throws Exception { return Completable.never(); } }, new Consumer<Object>() {
@Test(timeout = 5000) public void getTimeout() { try { Completable.never().blockingGet(100, TimeUnit.MILLISECONDS); } catch (RuntimeException ex) { if (!(ex.getCause() instanceof TimeoutException)) { Assert.fail("Wrong exception cause: " + ex.getCause()); } } }
@Override public Completable apply(Flowable<Object> f) throws Exception { return f.switchMapCompletable(Functions.justFunction(Completable.never())); } });
@Override public Completable apply(Observable<Object> f) throws Exception { return f.switchMapCompletable(Functions.justFunction(Completable.never())); } });
@Test public void ambLots() { List<Completable> ms = new ArrayList<Completable>(); for (int i = 0; i < 32; i++) { ms.add(Completable.never()); } ms.add(Completable.complete()); Completable.amb(ms) .test() .assertResult(); }
@Test public void disposed() { TestHelper.checkDisposed(Completable.never().delay(1, TimeUnit.MINUTES)); }
@Test(timeout = 5000) public void timeoutEmitError() { Throwable e = Completable.never().timeout(100, TimeUnit.MILLISECONDS).blockingGet(); Assert.assertTrue(e instanceof TimeoutException); }
@Test(timeout = 5000) public void timeoutSwitchNormal() { Completable c = Completable.never().timeout(100, TimeUnit.MILLISECONDS, normal.completable); c.blockingAwait(); normal.assertSubscriptions(1); }
@Test public void timeoutException() throws Exception { Completable.never() .timeout(100, TimeUnit.MILLISECONDS, Schedulers.io()) .test() .awaitDone(5, TimeUnit.SECONDS) .assertFailureAndMessage(TimeoutException.class, timeoutMessage(100, TimeUnit.MILLISECONDS)); }
@Test public void never() { Completable.never() .hide() .test() .assertNotComplete() .assertNoErrors(); }
@Test public void disposed() { TestHelper.checkDisposed( Completable.error(new TestException()) .onErrorResumeNext(Functions.justFunction(Completable.never())) ); } }
@Test public void andThenCompletableCompleteNever() { Completable.complete() .andThen(Completable.never()) .test() .assertNoValues() .assertNoErrors() .assertNotComplete(); }
@Test public void otherErrors() { Completable.never() .timeout(1, TimeUnit.MILLISECONDS, Completable.error(new TestException())) .test() .awaitDone(5, TimeUnit.SECONDS) .assertFailure(TestException.class); }
@Test public void andThenNever() { TestSubscriber<String> ts = new TestSubscriber<String>(0); Completable.never().andThen(Flowable.just("foo")).subscribe(ts); ts.request(1); ts.assertNoValues(); ts.assertNotTerminated(); }
@Test public void andThenSingleNever() { TestSubscriber<String> ts = new TestSubscriber<String>(0); Completable.never().andThen(Single.just("foo")).toFlowable().subscribe(ts); ts.request(1); ts.assertNoValues(); ts.assertNotTerminated(); }
@Test public void andThenCompletableErrorNever() { Completable.error(new TestException("bla")) .andThen(Completable.never()) .test() .assertNotComplete() .assertNoValues() .assertError(TestException.class) .assertErrorMessage("bla"); }