@Override public SingleSource<Integer> apply(Disposable v) throws Exception { return Single.<Integer>error(new TestException("Mapper-run")); } }, disposerThrows)
@Override public SingleSource<Integer> apply(Integer v) throws Exception { return Single.error(new TestException()); } }, true)
@Override public Single<Integer> apply(Integer v) throws Exception { sleep(); return Single.<Integer>error(new TestException()); } })
@Test public void errorCallableThrows() { Single.error(new Callable<Throwable>() { @Override public Throwable call() throws Exception { throw new TestException(); } }) .test() .assertFailure(TestException.class); } }
@Test public void fromSingleThrows() { Maybe.fromSingle(Single.error(new UnsupportedOperationException())) .test() .assertFailure(UnsupportedOperationException.class); }
@Test public void ambWithOrder() { Single<Integer> error = Single.error(new RuntimeException()); Single.just(1).ambWith(error).test().assertValue(1); }
@Test public void singleSubscribe1() { Single.error(new TestException()) .subscribe(Functions.emptyConsumer()); }
@SuppressWarnings("unchecked") @Test public void firstError() { Single.zip(Arrays.asList(Single.error(new TestException()), Single.just(1)), addString) .test() .assertFailure(TestException.class); }
@SuppressWarnings("unchecked") @Test public void secondError() { Single.zip(Arrays.asList(Single.just(1), Single.<Integer>error(new TestException())), addString) .test() .assertFailure(TestException.class); }
@Test public void errorConditional() { Single.<Integer>error(new TestException()) .doAfterSuccess(afterSuccess) .filter(Functions.alwaysTrue()) .subscribeWith(ts) .assertFailure(TestException.class); assertTrue(values.isEmpty()); }
@Test public void mainError() { Single.error(new TestException()) .timeout(1, TimeUnit.DAYS) .test() .awaitDone(5, TimeUnit.SECONDS) .assertFailure(TestException.class); } }
@Test public void firstError() { Single.zip(Single.error(new TestException()), Single.just(1), addString) .test() .assertFailure(TestException.class); }
@Test public void error() { Single.<Integer>error(new TestException()) .doAfterTerminate(afterTerminate) .subscribeWith(ts) .assertFailure(TestException.class); assertAfterTerminateCalledOnce(); }
@Test public void onErrorResumeNext() { Single.<Integer>error(new TestException()) .onErrorResumeNext(Single.just(1)) .test() .assertResult(1); }
@Test public void normalError() { Single.error(new TestException()) .doFinally(this) .test() .assertFailure(TestException.class); assertEquals(1, calls); }
@Test public void withSingleErrors() { Single.just(1) .delaySubscription(Single.error(new TestException())) .test() .assertFailure(TestException.class); }
@Test public void error() { Single.error(new TestException()) .filter(Functions.alwaysTrue()) .test() .assertFailure(TestException.class); }
@Test public void otherErrors() { Single.never() .timeout(1, TimeUnit.MILLISECONDS, Single.error(new TestException())) .test() .awaitDone(5, TimeUnit.SECONDS) .assertFailure(TestException.class); }
@Test public void errorNonEager() { Single.using(Functions.justCallable(1), Functions.justFunction(Single.error(new TestException())), Functions.emptyConsumer(), false) .test() .assertFailure(TestException.class); }
@Test public void errorConditional() { Single.<Integer>error(new TestException()) .doAfterTerminate(afterTerminate) .filter(Functions.alwaysTrue()) .subscribeWith(ts) .assertFailure(TestException.class); assertAfterTerminateCalledOnce(); }