@Override public Nono apply(Integer v) throws Exception { if (v == 2) { return ioError; } return Nono.complete().delay(50, TimeUnit.MILLISECONDS); } }), 1)
@Override public Nono apply(Integer v) throws Exception { return Nono.complete().delay(50, TimeUnit.MILLISECONDS); } }))
@Override public Nono apply(Integer v) throws Exception { return Nono.complete().delay(50, TimeUnit.MILLISECONDS); } }))
@Test public void blockingSubscribe2() { Nono.complete() .blockingSubscribe(this, this); Assert.assertEquals(1, count); }
@Test public void subscribe2() { Nono.complete() .subscribe(this, this); Assert.assertEquals(1, count); }
@Test public void mergeIterableMaxConcurrentDelayErrorError() { Nono.mergeDelayError(Arrays.asList( Nono.complete().delay(50, TimeUnit.MILLISECONDS), ioError.delay(50, TimeUnit.MILLISECONDS), Nono.complete().delay(100, TimeUnit.MILLISECONDS) ), 1) .test() .awaitDone(5, TimeUnit.SECONDS) .assertFailure(IOException.class); }
@Test public void amb1() { Nono.amb(Arrays.asList(Nono.complete(), Nono.never())) .test() .assertResult(); }
@Test public void amb2() { Nono.amb(Arrays.asList(Nono.never(), Nono.complete())) .test() .assertResult(); }
@Test public void mergeArrayMaxConcurrentDelayErrorError() { Nono.mergeArrayDelayError(1, 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 retryWhenThrows() { Nono.complete() .retryWhen(new Function<Flowable<Throwable>, Publisher<Throwable>>() { @Override public Publisher<Throwable> apply(Flowable<Throwable> f) throws Exception { throw new IOException(); } }) .test() .assertFailure(IOException.class); }
@Test public void andThen() { Nono.complete().andThen(Flowable.range(1, 5)) .test() .assertResult(1, 2, 3, 4, 5); }
@Test public void doOnComplete1() { Nono.complete() .doOnComplete(this) .test() .assertResult(); Assert.assertEquals(1, count); }
@Test public void doOnSubscribe() { Nono.complete() .doOnSubscribe(this) .test() .assertResult(); Assert.assertEquals(1, count); }
@Test public void doOnError1() { Nono.complete() .doOnError(this) .test() .assertResult(); Assert.assertEquals(0, count); }
@Test public void andThenBackpressure() { Nono.complete().andThen(Flowable.range(1, 5)) .rebatchRequests(1) .test() .assertResult(1, 2, 3, 4, 5); }
@Test public void usingNonEager() { Nono.using( Functions.justCallable(1), Functions.justFunction(Nono.complete()), this, false ) .test() .assertResult(); Assert.assertEquals(1, count); }
@Test public void using() { Nono.using( Functions.justCallable(1), Functions.justFunction(Nono.complete()), this ) .test() .assertResult(); Assert.assertEquals(1, count); }