@Test public void emitsNullPointerExceptionWhenNullHandlerIsSupplied() { given(handlerSupplier.get()).willReturn(null); final TestObserver<Object> subscriber = new TestObserver<>(); underTest.prepare(request, handlerSupplier).subscribe(subscriber); subscriber.assertTerminated(); subscriber.assertNoValues(); subscriber.assertError(NullPointerException.class); then(handlerSupplier).should().get(); verifyNoMoreInteractions(handlerSupplier); }
@Override public <T> Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier) { requireNonNull(request); requireNonNull(handlerSupplier); return Maybe.create(emitter -> { final AsyncHandler<?> bridge = createBridge(emitter, handlerSupplier.get()); final Future<?> responseFuture = asyncHttpClient.executeRequest(request, bridge); emitter.setDisposable(Disposables.fromFuture(responseFuture)); }); }
DefaultRxHttpClient implements RxHttpClient { @Override public <T> Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier) { requireNonNull(request); requireNonNull(handlerSupplier); return Maybe.create(emitter -> { final AsyncHandler<?> bridge = createBridge(emitter, handlerSupplier.get()); final Future<?> responseFuture = asyncHttpClient.executeRequest(request, bridge); emitter.setDisposable(Disposables.fromFuture(responseFuture)); }); } }
DefaultRxHttpClient implements RxHttpClient { @Override public <T> Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier) { requireNonNull(request); requireNonNull(handlerSupplier); return Maybe.create(emitter -> { final AsyncHandler<?> bridge = createBridge(emitter, handlerSupplier.get()); final Future<?> responseFuture = asyncHttpClient.executeRequest(request, bridge); emitter.setDisposable(Disposables.fromFuture(responseFuture)); }); } DefaultRxHttpClient(AsyncHttpClient asyncHttpClient); }
DefaultRxHttpClient implements RxHttpClient { @Override public <T> Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier) { requireNonNull(request); requireNonNull(handlerSupplier); return Maybe.create(emitter -> { final AsyncHandler<?> bridge = createBridge(emitter, handlerSupplier.get()); final Future<?> responseFuture = asyncHttpClient.executeRequest(request, bridge); emitter.setDisposable(Disposables.fromFuture(responseFuture)); }); } DefaultRxHttpClient(AsyncHttpClient asyncHttpClient); @Override Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier); }
DefaultRxHttpClient implements RxHttpClient { @Override public <T> Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier) { requireNonNull(request); requireNonNull(handlerSupplier); return Maybe.create(emitter -> { final AsyncHandler<?> bridge = createBridge(emitter, handlerSupplier.get()); final Future<?> responseFuture = asyncHttpClient.executeRequest(request, bridge); emitter.setDisposable(Disposables.fromFuture(responseFuture)); }); } DefaultRxHttpClient(AsyncHttpClient asyncHttpClient); @Override Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier);  }