@Test public void rightDurationSelectorThrows() { AssertSubscriber<Object> ts = AssertSubscriber.create(); DirectProcessor<Integer> source1 = DirectProcessor.create(); DirectProcessor<Integer> source2 = DirectProcessor.create(); Function<Integer, Flux<Integer>> fail = t1 -> { throw new RuntimeException("Forced failure"); }; Flux<Flux<Integer>> m = source1.groupJoin(source2, just(Flux.never()), fail, add2); m.subscribe(ts); source2.onNext(1); ts.assertErrorMessage("Forced failure") .assertNotComplete() .assertNoValues(); }
@Test public void leftDurationSelectorThrows() { AssertSubscriber<Object> ts = AssertSubscriber.create(); DirectProcessor<Integer> source1 = DirectProcessor.create(); DirectProcessor<Integer> source2 = DirectProcessor.create(); Function<Integer, Flux<Integer>> fail = t1 -> { throw new RuntimeException("Forced failure"); }; Flux<Flux<Integer>> m = source1.groupJoin(source2, fail, just(Flux.never()), add2); m.subscribe(ts); source1.onNext(1); ts.assertErrorMessage("Forced failure") .assertNotComplete() .assertNoValues(); }
@Test public void leftDurationThrows() { AssertSubscriber<Object> ts = AssertSubscriber.create(); DirectProcessor<Integer> source1 = DirectProcessor.create(); DirectProcessor<Integer> source2 = DirectProcessor.create(); Flux<Integer> duration1 = Flux.error(new RuntimeException("Forced failure")); Flux<Flux<Integer>> m = source1.groupJoin(source2, just(duration1), just(Flux.never()), add2); m.subscribe(ts); source1.onNext(1); ts.assertErrorMessage("Forced failure") .assertNotComplete() .assertNoValues(); }
@Test public void rightDurationThrows() { AssertSubscriber<Object> ts = AssertSubscriber.create(); DirectProcessor<Integer> source1 = DirectProcessor.create(); DirectProcessor<Integer> source2 = DirectProcessor.create(); Flux<Integer> duration1 = Flux.error(new RuntimeException("Forced failure")); Flux<Flux<Integer>> m = source1.groupJoin(source2, just(Flux.never()), just(duration1), add2); m.subscribe(ts); source2.onNext(1); ts.assertErrorMessage("Forced failure") .assertNotComplete() .assertNoValues(); }
@Test public void leftThrows() { AssertSubscriber<Object> ts = AssertSubscriber.create(); DirectProcessor<Integer> source1 = DirectProcessor.create(); DirectProcessor<Integer> source2 = DirectProcessor.create(); Flux<Flux<Integer>> m = source1.groupJoin(source2, just(Flux.never()), just(Flux.never()), add2); m.subscribe(ts); source2.onNext(1); source1.onError(new RuntimeException("Forced failure")); ts.assertErrorMessage("Forced failure") .assertNotComplete() .assertNoValues(); }
@Test public void rightThrows() { AssertSubscriber<Object> ts = AssertSubscriber.create(); DirectProcessor<Integer> source1 = DirectProcessor.create(); DirectProcessor<Integer> source2 = DirectProcessor.create(); Flux<Flux<Integer>> m = source1.groupJoin(source2, just(Flux.never()), just(Flux.never()), add2); m.subscribe(ts); source1.onNext(1); source2.onError(new RuntimeException("Forced failure")); ts.assertErrorMessage("Forced failure") .assertNotComplete() .assertValueCount(1); }
@Test public void resultSelectorThrows() { AssertSubscriber<Object> ts = AssertSubscriber.create(); DirectProcessor<Integer> source1 = DirectProcessor.create(); DirectProcessor<Integer> source2 = DirectProcessor.create(); BiFunction<Integer, Flux<Integer>, Integer> fail = (t1, t2) -> { throw new RuntimeException("Forced failure"); }; Flux<Integer> m = source1.groupJoin(source2, just(Flux.never()), just(Flux.never()), fail); m.subscribe(ts); source1.onNext(1); source2.onNext(2); ts.assertErrorMessage("Forced failure") .assertNotComplete() .assertNoValues(); }
@Test public void behaveAsJoin() { AssertSubscriber<Object> ts = AssertSubscriber.create(); DirectProcessor<Integer> source1 = DirectProcessor.create(); DirectProcessor<Integer> source2 = DirectProcessor.create(); Flux<Integer> m = source1.groupJoin(source2, just(Flux.never()), just(Flux.never()), add2) .flatMap(t -> t); m.subscribe(ts); source1.onNext(1); source1.onNext(2); source1.onNext(4); source2.onNext(16); source2.onNext(32); source2.onNext(64); source1.onComplete(); source2.onComplete(); ts.assertValues(17, 18, 20, 33, 34, 36, 65, 66, 68) .assertComplete() .assertNoError(); }