### Question:
MultiOnErrorResumeWith implements Multi<T> { @Override public void subscribe(Flow.Subscriber<? super T> subscriber) { source.subscribe(new OnErrorResumeWithSubscriber<>(subscriber, fallbackFunction)); } MultiOnErrorResumeWith(Multi<T> source,
           Function<? super Throwable, ? extends Flow.Publisher<? extends T>> fallbackFunction); @Override void subscribe(Flow.Subscriber<? super T> subscriber);  }### Answer:
@Test public void fallbackFunctionCrash() { TestSubscriber<Integer> ts = new TestSubscriber<>(); Multi.<Integer>error(new IOException()) .onErrorResumeWith(e -> { throw new IllegalArgumentException(); }) .subscribe(ts); ts.assertFailure(IllegalArgumentException.class); assertThat(ts.getLastError().getSuppressed()[0], instanceOf(IOException.class)); }
@Test public void fallbackToError() { TestSubscriber<Integer> ts = new TestSubscriber<>(); Multi.<Integer>error(new IOException()) .onErrorResumeWith(e -> Multi.error(new IllegalArgumentException())) .subscribe(ts); ts.assertFailure(IllegalArgumentException.class); }
@Test public void emptySource() { TestSubscriber<Integer> ts = new TestSubscriber<>(); Multi.<Integer>empty() .onErrorResumeWith(e -> Multi.just(e.hashCode())) .subscribe(ts); ts.assertResult(); }
@Test public void emptyFallback() { TestSubscriber<Integer> ts = new TestSubscriber<>(); Multi.<Integer>error(new IOException()) .onErrorResumeWith(e -> Multi.empty()) .subscribe(ts); ts.assertResult(); }
@Test public void failAfterItems() { TestSubscriber<Integer> ts = new TestSubscriber<>(Long.MAX_VALUE); Multi.concat(Multi.range(1, 3), Multi.<Integer>error(new IOException())) .onErrorResumeWith(v -> Multi.range(4, 2)) .subscribe(ts); ts.assertResult(1, 2, 3, 4, 5); }
@Test public void failAfterItemsBackpressure() { TestSubscriber<Integer> ts = new TestSubscriber<>(); Multi.concat(Multi.range(1, 3), Multi.<Integer>error(new IOException())) .onErrorResumeWith(v -> Multi.range(4, 2)) .subscribe(ts); ts.assertEmpty() .request(3) .assertValuesOnly(1, 2, 3) .request(2) .assertResult(1, 2, 3, 4, 5); }
@Test public void noSelfSuppressionFailure() { TestSubscriber<Integer> ts = new TestSubscriber<>(); Multi.<Integer>error(new IllegalArgumentException()) .onErrorResumeWith(e -> { throw (IllegalArgumentException)e; }) .subscribe(ts); ts.assertFailure(IllegalArgumentException.class); }