### Question:
MultiReduce extends CompletionSingle<T> { @Override public void subscribe(Flow.Subscriber<? super T> subscriber) { source.subscribe(new ReducerSubscriber<>(subscriber, reducer)); } MultiReduce(Multi<T> source, BiFunction<T, T, T> reducer); @Override void subscribe(Flow.Subscriber<? super T> subscriber);  }### Answer:
@Test public void empty() { TestSubscriber<Object> ts = new TestSubscriber<>(); Multi.<Integer>empty().reduce(Integer::sum) .subscribe(ts); ts.assertResult(); }
@Test public void single() { TestSubscriber<Object> ts = new TestSubscriber<>(Long.MAX_VALUE); Multi.singleton(1).reduce(Integer::sum) .subscribe(ts); ts.assertResult(1); }
@Test public void range() { TestSubscriber<Object> ts = new TestSubscriber<>(Long.MAX_VALUE); Multi.range(1, 10).reduce(Integer::sum) .subscribe(ts); ts.assertResult(55); }
@Test public void error() { TestSubscriber<Object> ts = new TestSubscriber<>(); Multi.<Integer>error(new IOException()).reduce(Integer::sum) .subscribe(ts); ts.assertFailure(IOException.class); }
@Test public void reducerNull() { TestSubscriber<Object> ts = new TestSubscriber<>(); Multi.range(1, 5) .reduce((a, b) -> null) .subscribe(ts); ts.assertFailure(NullPointerException.class); }
@Test public void reducerCrash() { TestSubscriber<Object> ts = new TestSubscriber<>(); Multi.range(1, 5) .reduce((a, b) -> { throw new IllegalArgumentException(); }) .subscribe(ts); ts.assertFailure(IllegalArgumentException.class); }
@Test public void cancel() { TestSubscriber<Object> ts = new TestSubscriber<>(); Multi.<Integer>never() .reduce(Integer::sum) .subscribe(ts); ts.cancel(); ts.assertEmpty(); }