@Override public MaybeSource<Integer> apply(Completable c) throws Exception { return c.andThen(Maybe.just(1)); } });
@Override public Publisher<Object> apply(Completable m) throws Exception { return m.andThen(Flowable.never()); } });
@Override public Single<Object> apply(Completable c) throws Exception { return c.andThen(Single.just((Object)1)); } });
@Test(expected = NullPointerException.class) public void andThenMaybeNull() { Completable.complete() .andThen((Maybe<Object>) null); }
@Test(expected = NullPointerException.class) public void andThenCompletableCompleteNull() { Completable.complete() .andThen((Completable) null); }
@Override public Publisher<Integer> createPublisher(final long elements) { return Completable.complete().hide().andThen(Flowable.range(0, (int)elements)) ; } }
@Test public void andThenDisposed() { TestHelper.checkDisposed(Completable.complete() .andThen(Completable.complete())); }
@Test public void andThenCompletableCompleteComplete() { Completable.complete() .andThen(Completable.complete()) .test() .assertComplete(); }
@Test(timeout = 5000) public void andThenCompletableError() { Completable c = normal.completable.andThen(error.completable); try { c.blockingAwait(); Assert.fail("Did not throw TestException"); } catch (TestException ex) { normal.assertSubscriptions(1); error.assertSubscriptions(1); } }
@Test public void andThenMaybeCompleteError() { Completable.complete() .andThen(Maybe.error(new RuntimeException("test"))) .test() .assertNotComplete() .assertNoValues() .assertError(RuntimeException.class) .assertErrorMessage("test"); }
@Test public void andThenMaybeError() { Completable.error(new RuntimeException("bla")) .andThen(Maybe.empty()) .test() .assertNotComplete() .assertNoValues() .assertError(RuntimeException.class) .assertErrorMessage("bla"); } }
@Test public void andThenCompletableCompleteNever() { Completable.complete() .andThen(Completable.never()) .test() .assertNoValues() .assertNoErrors() .assertNotComplete(); }
@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 andThenCompletableErrorNever() { Completable.error(new TestException("bla")) .andThen(Completable.never()) .test() .assertNotComplete() .assertNoValues() .assertError(TestException.class) .assertErrorMessage("bla"); }
@Test(timeout = 5000) public void andThenFlowableError() { Flowable<Object> c = normal.completable .andThen(Flowable.error(new TestException())); TestSubscriber<Object> ts = new TestSubscriber<Object>(); c.subscribe(ts); normal.assertSubscriptions(1); ts.assertNoValues(); ts.assertError(TestException.class); ts.assertNotComplete(); }
@Test public void andThenCompletableCompleteError() { Completable.complete() .andThen(Completable.error(new TestException("test"))) .test() .assertNotComplete() .assertNoValues() .assertError(TestException.class) .assertErrorMessage("test"); }
@Test public void andThenCompletableErrorComplete() { Completable.error(new TestException("bla")) .andThen(Completable.complete()) .test() .assertNotComplete() .assertNoValues() .assertError(TestException.class) .assertErrorMessage("bla"); }
@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 andThenCompletableErrorError() { Completable.error(new TestException("error1")) .andThen(Completable.error(new TestException("error2"))) .test() .assertNotComplete() .assertNoValues() .assertError(TestException.class) .assertErrorMessage("error1"); }
@Test public void andThenSingle() { TestSubscriber<String> ts = new TestSubscriber<String>(0); Completable.complete().andThen(Single.just("foo")).toFlowable().subscribe(ts); ts.request(1); ts.assertValue("foo"); ts.assertComplete(); ts.assertNoErrors(); }