/** * Blocks until this Perhaps terminates and calls the onNext with the success value. * @param onNext the callback to call when this Perhaps completes with a success value */ public final void blockingSubscribe(Consumer<? super T> onNext) { blockingSubscribe(onNext, Functions.ERROR_CONSUMER, Functions.EMPTY_ACTION); }
/** * Blocks until this Perhaps terminates and calls the onNext with the success value * or calls the onError with the error Throwable. * @param onNext the callback to call when this Perhaps completes with a success value * @param onError the callback to call when this Perhaps fails with an error */ public final void blockingSubscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError) { blockingSubscribe(onNext, onError, Functions.EMPTY_ACTION); }
/** * Blocks until this Perhaps terminates and calls the onNext with the success value * or calls the onError with the error Throwable. * @param onNext the callback to call when this Perhaps completes with a success value * @param onError the callback to call when this Perhaps fails with an error */ public final void blockingSubscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError) { blockingSubscribe(onNext, onError, Functions.EMPTY_ACTION); }
/** * Blocks until this Perhaps terminates and calls the onNext with the success value. * @param onNext the callback to call when this Perhaps completes with a success value */ public final void blockingSubscribe(Consumer<? super T> onNext) { blockingSubscribe(onNext, Functions.ERROR_CONSUMER, Functions.EMPTY_ACTION); }
/** * Blocks until this Perhaps terminates and ignores the signals it produced. */ public final void blockingSubscribe() { blockingSubscribe(Functions.emptyConsumer(), Functions.ERROR_CONSUMER, Functions.EMPTY_ACTION); }
/** * Blocks until this Perhaps terminates and ignores the signals it produced. */ public final void blockingSubscribe() { blockingSubscribe(Functions.emptyConsumer(), Functions.ERROR_CONSUMER, Functions.EMPTY_ACTION); }
@Test public void blockingSubscribeTwoArgError() { Perhaps.error(new IOException()).blockingSubscribe(this, this); assertEquals(1, count); }
@Test public void blockingSubscribeThreeArgError() { Perhaps.error(new IOException()).blockingSubscribe(this, this, this); assertEquals(1, count); }
@Test public void blockingSubscribeOneArg() { Perhaps.just(1).blockingSubscribe(this); assertEquals(1, count); }
@Test public void blockingSubscribeTwoArg() { Perhaps.just(1).blockingSubscribe(this, this); assertEquals(1, count); }
@Test public void blockingSubscribeThreeArg() { Perhaps.just(1).blockingSubscribe(this, this, this); assertEquals(2, count); }
@Test public void blockingSubscribeZeroArg() { Perhaps.just(1) .doOnNext(this) .blockingSubscribe(); assertEquals(1, count); }