@Test public void complete() { Nono.complete() .test() .assertResult(); }
@Test public void errorSupplier() { Nono.error(new Callable<Throwable>() { @Override public Throwable call() throws Exception { return new IOException(); } }) .test() .assertFailure(IOException.class); }
@Test public void amb1Error() { Nono.amb(Arrays.asList(Nono.error(new IOException()), Nono.never(), Nono.never())) .test() .assertFailure(IOException.class); }
@Test public void fromCompletable1() { Nono.fromCompletable(Completable.complete()) .test() .assertResult(); }
@Test public void doOnSubscribeThrows() { Nono.complete() .doOnSubscribe(new Consumer<Object>() { @Override public void accept(Object t) throws Exception { throw new IOException(); } }) .test() .assertFailure(IOException.class); }
@Test public void fromObservable1() { Nono.fromObservable(Observable.empty()) .test() .assertResult(); }
@Test public void doOnError2() { ioError .doOnError(this) .test() .assertFailure(IOException.class); Assert.assertEquals(1, count); }
@Test public void ambArray1Error() { Nono.ambArray(Nono.error(new IOException()), Nono.never(), Nono.never()) .test() .assertFailure(IOException.class); }
@Test public void concatIterable() { Nono.concat(Arrays.asList(Nono.fromAction(this), Nono.fromAction(this))) .test() .assertResult(); Assert.assertEquals(2, count); }
@Test public void onErrorComplete() { Nono.fromAction(this).onErrorComplete() .test() .assertResult(); Assert.assertEquals(1, count); }
@Test public void takeUntil5() { Nono.never().takeUntil(Flowable.range(1, 2)) .test() .assertResult(); }
@Test public void concatPublisherDelayError() { Nono.concatDelayError( Flowable.fromArray(Nono.fromAction(this), Nono.error(new IOException()), Nono.fromAction(this))) .test() .assertFailure(IOException.class); Assert.assertEquals(2, count); }
@Test public void fromPublisher6() { Nono np = Nono.fromPublisher(Nono.complete()); np .test() .assertResult(); Assert.assertSame(np, Nono.complete()); }
@Test public void delaySubscription1() { Nono.fromAction(this).delaySubscription(Nono.complete()) .test() .assertResult(); Assert.assertEquals(1, count); }
@Test public void mergeIterableDelayErrorError() { Nono.mergeDelayError(Arrays.asList( Nono.complete().delay(50, TimeUnit.MILLISECONDS), ioError.delay(50, TimeUnit.MILLISECONDS), Nono.complete().delay(100, TimeUnit.MILLISECONDS) )) .test() .awaitDone(5, TimeUnit.SECONDS) .assertFailure(IOException.class); }
@Test public void mergeIterableMaxConcurrentDelayError() { Nono.mergeDelayError(Arrays.asList( Nono.complete().delay(50, TimeUnit.MILLISECONDS), Nono.complete().delay(50, TimeUnit.MILLISECONDS), Nono.complete().delay(100, TimeUnit.MILLISECONDS) ), 1) .test() .awaitDone(5, TimeUnit.SECONDS) .assertResult(); }
@Test public void compose() { Nono.fromAction(this).compose(Functions.justFunction(Nono.complete())) .test() .assertResult(); Assert.assertEquals(0, count); }
@Test public void timeout10() { Nono.fromAction(this) .delay(1, TimeUnit.SECONDS) .timeout(10, TimeUnit.MILLISECONDS, ioError) .test() .awaitDone(5, TimeUnit.SECONDS) .assertFailure(IOException.class); Assert.assertEquals(1, count); }
@Test public void mergeArray() { Nono.mergeArray( Nono.complete().delay(50, TimeUnit.MILLISECONDS), Nono.complete().delay(50, TimeUnit.MILLISECONDS), Nono.complete().delay(100, TimeUnit.MILLISECONDS) ) .test() .awaitDone(5, TimeUnit.SECONDS) .assertResult(); }
@Test public void mergeArrayDelayError() { Nono.mergeArrayDelayError( Nono.complete().delay(50, TimeUnit.MILLISECONDS), Nono.complete().delay(50, TimeUnit.MILLISECONDS), Nono.complete().delay(100, TimeUnit.MILLISECONDS) ) .test() .awaitDone(5, TimeUnit.SECONDS) .assertResult(); }