@Test public void testErrorInOnThrowablePropagation() { final RuntimeException processingException = new RuntimeException("processing"); final RuntimeException thrownException = new RuntimeException("thrown"); @SuppressWarnings("unchecked") final AsyncHandler<Object> handler = mock(AsyncHandler.class); doThrow(thrownException).when(handler).onThrowable(processingException); final Single<?> underTest = AsyncHttpSingle.create(bridge -> { try { bridge.onThrowable(processingException); return mock(Future.class); } catch (final Throwable t) { throw new AssertionError(t); } }, () -> handler); final TestSubscriber<Object> subscriber = new TestSubscriber<>(); underTest.subscribe(subscriber); verify(handler).onThrowable(processingException); verifyNoMoreInteractions(handler); subscriber.awaitTerminalEvent(); subscriber.assertTerminalEvent(); subscriber.assertNoValues(); final List<Throwable> errorEvents = subscriber.getOnErrorEvents(); assertEquals(errorEvents.size(), 1); assertThat(errorEvents.get(0), is(instanceOf(CompositeException.class))); final CompositeException error = (CompositeException) errorEvents.get(0); assertEquals(error.getExceptions(), Arrays.asList(processingException, thrownException)); }
public static Single<Response> create(BoundRequestBuilder builder) { requireNonNull(builder); return create(builder::execute, AsyncCompletionHandlerBase::new); }
AsyncHttpSingle { public static Single<Response> create(BoundRequestBuilder builder) { requireNonNull(builder); return create(builder::execute, AsyncCompletionHandlerBase::new); } }
AsyncHttpSingle { public static Single<Response> create(BoundRequestBuilder builder) { requireNonNull(builder); return create(builder::execute, AsyncCompletionHandlerBase::new); } private  AsyncHttpSingle(); }
AsyncHttpSingle { public static Single<Response> create(BoundRequestBuilder builder) { requireNonNull(builder); return create(builder::execute, AsyncCompletionHandlerBase::new); } private  AsyncHttpSingle(); static Single<Response> create(BoundRequestBuilder builder); static Single<Response> create(Func1<? super AsyncHandler<?>, ? extends Future<?>> requestTemplate); static Single<T> create(BoundRequestBuilder builder, Func0<? extends AsyncHandler<? extends T>> handlerSupplier); static Single<T> create(Func1<? super AsyncHandler<?>, ? extends Future<?>> requestTemplate,
                                     Func0<? extends AsyncHandler<? extends T>> handlerSupplier); }
AsyncHttpSingle { public static Single<Response> create(BoundRequestBuilder builder) { requireNonNull(builder); return create(builder::execute, AsyncCompletionHandlerBase::new); } private  AsyncHttpSingle(); static Single<Response> create(BoundRequestBuilder builder); static Single<Response> create(Func1<? super AsyncHandler<?>, ? extends Future<?>> requestTemplate); static Single<T> create(BoundRequestBuilder builder, Func0<? extends AsyncHandler<? extends T>> handlerSupplier); static Single<T> create(Func1<? super AsyncHandler<?>, ? extends Future<?>> requestTemplate,
                                     Func0<? extends AsyncHandler<? extends T>> handlerSupplier);  }