@Test public void testTransformToMultiWithNullReturnedByMapperWithCancellationDuringTheMultiEmissions() { final AtomicBoolean called = new AtomicBoolean(); final AtomicBoolean calledUni = new AtomicBoolean(); Uni.createFrom().item(1) .onCancellation().invoke(() -> calledUni.set(true)) .onItem().transformToMulti(i -> Multi.createFrom().nothing() .on().cancellation(() -> called.set(true))) .subscribe().withSubscriber(AssertSubscriber.create(10)) .assertNotTerminated() .assertHasNotReceivedAnyItem() .run(() -> assertThat(called).isFalse()) .cancel() .run(() -> assertThat(called).isTrue()) .run(() -> assertThat(calledUni).isFalse()) .assertNotTerminated(); }
@Override public void subscribe(MultiSubscriber<? super O> subscriber) { if (subscriber == null) { throw new NullPointerException("The subscriber must not be `null`"); } AbstractUni.subscribe(upstream, new FlatMapPublisherSubscriber<>(subscriber, mapper)); }
UniOnItemTransformToMulti extends AbstractMulti<O> { @Override public void subscribe(MultiSubscriber<? super O> subscriber) { if (subscriber == null) { throw new NullPointerException("The subscriber must not be `null`"); } AbstractUni.subscribe(upstream, new FlatMapPublisherSubscriber<>(subscriber, mapper)); } }
UniOnItemTransformToMulti extends AbstractMulti<O> { @Override public void subscribe(MultiSubscriber<? super O> subscriber) { if (subscriber == null) { throw new NullPointerException("The subscriber must not be `null`"); } AbstractUni.subscribe(upstream, new FlatMapPublisherSubscriber<>(subscriber, mapper)); } UniOnItemTransformToMulti(Uni<I> upstream, Function<? super I, ? extends Publisher<? extends O>> mapper); }
UniOnItemTransformToMulti extends AbstractMulti<O> { @Override public void subscribe(MultiSubscriber<? super O> subscriber) { if (subscriber == null) { throw new NullPointerException("The subscriber must not be `null`"); } AbstractUni.subscribe(upstream, new FlatMapPublisherSubscriber<>(subscriber, mapper)); } UniOnItemTransformToMulti(Uni<I> upstream, Function<? super I, ? extends Publisher<? extends O>> mapper); @Override void subscribe(MultiSubscriber<? super O> subscriber); }
UniOnItemTransformToMulti extends AbstractMulti<O> { @Override public void subscribe(MultiSubscriber<? super O> subscriber) { if (subscriber == null) { throw new NullPointerException("The subscriber must not be `null`"); } AbstractUni.subscribe(upstream, new FlatMapPublisherSubscriber<>(subscriber, mapper)); } UniOnItemTransformToMulti(Uni<I> upstream, Function<? super I, ? extends Publisher<? extends O>> mapper); @Override void subscribe(MultiSubscriber<? super O> subscriber);  }