@Test(expected = IllegalArgumentException.class) public void toError2() { Nono.fromAction(this).to(new Function<Nono, Object>() { @Override public Object apply(Nono np) throws Exception { throw new IllegalArgumentException(); } }); }
@Test public void concatIterable() { Nono.concat(Arrays.asList(Nono.fromAction(this), Nono.fromAction(this))) .test() .assertResult(); Assert.assertEquals(2, count); }
@Test public void concatArrayDelayError() { Nono.concatArrayDelayError( Nono.fromAction(this), Nono.error(new IOException()), Nono.fromAction(this)) .test() .assertFailure(IOException.class); Assert.assertEquals(2, count); }
@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 concatPublisher2() { Nono.concat(Flowable.fromArray( Nono.fromAction(this), Nono.fromAction(this)), 2) .test() .assertResult(); Assert.assertEquals(2, count); }
@Test public void blockingSubscribe() { Nono.fromAction(this) .delay(100, TimeUnit.MILLISECONDS) .blockingSubscribe(); }
@Test public void concatPublisher() { Nono.concat(Flowable.fromArray(Nono.fromAction(this), Nono.fromAction(this))) .test() .assertResult(); Assert.assertEquals(2, count); }
@Test public void concatPublisherDelayErrorMain() { Nono.concatDelayError( Flowable.fromArray( Nono.fromAction(this), Nono.fromAction(this)) .concatWith(Flowable.<Nono>error(new IOException())) ) .test() .assertFailure(IOException.class); Assert.assertEquals(2, count); }
@Test public void mapError() { Nono.fromAction(this).mapError(Functions.justFunction(new IllegalArgumentException())) .test() .assertResult(); Assert.assertEquals(1, count); }
@Test public void concatArrayError() { Nono.concatArray(Nono.fromAction(this), Nono.error(new IOException())) .test() .assertFailure(IOException.class); Assert.assertEquals(1, count); }
@Test public void delaySubscription4() { Nono.fromAction(this).delaySubscription(Flowable.error(new IOException())) .test() .assertFailure(IOException.class); Assert.assertEquals(0, count); }
@Test public void onErrorComplete() { Nono.fromAction(this).onErrorComplete() .test() .assertResult(); Assert.assertEquals(1, count); }
@Test public void concatPublisherError() { Nono.concat(Flowable.fromArray(Nono.fromAction(this), Nono.error(new IOException()))) .test() .assertFailure(IOException.class); Assert.assertEquals(1, count); }
@Test public void andThenNono2() { Nono.fromAction(this).andThen(ioError) .test() .assertFailure(IOException.class); Assert.assertEquals(1, count); }
@Test public void toMaybe() { Nono.fromAction(this).toMaybe() .test() .assertResult(); Assert.assertEquals(1, count); }
@Test public void delaySubscription1() { Nono.fromAction(this).delaySubscription(Nono.complete()) .test() .assertResult(); Assert.assertEquals(1, count); }
@Test public void flatMap5() { Nono.fromAction(this).flatMap( Functions.justFunction(Flowable.just(1)), Functions.justCallable(Flowable.error(new IllegalArgumentException())) ) .test() .assertFailure(IllegalArgumentException.class); Assert.assertEquals(1, count); }
@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 flatMap1() { Nono.fromAction(this).flatMap(Functions.justFunction(Flowable.just(1)), Functions.justCallable(Flowable.just(2))) .test() .assertResult(2); }