@Test public void testFunctionConsumerError() { StreamMapper<Integer, Integer> mapper = StreamMapper.create(input -> input * input); List<Integer> list = new ArrayList<>(); StreamSupplier<Integer> source1 = StreamSupplier.of(1, 2, 3); StreamConsumerToList<Integer> consumer = StreamConsumerToList.create(list); ExpectedException exception = new ExpectedException("Test Exception"); Throwable e = awaitException(source1.transformWith(mapper) .streamTo(consumer .transformWith(decorate(promise -> promise.then( item -> item == 2 * 2 ? Promise.ofException(exception) : Promise.of(item)))))); assertSame(exception, e); assertEquals(asList(1, 4), list); assertClosedWithError(source1); assertClosedWithError(consumer); assertClosedWithError(mapper); }
public static <I, O> StreamMapper<I, O> create(Function<I, O> function) { return new StreamMapper<>(function); }
StreamMapper implements StreamTransformer<I, O> { public static <I, O> StreamMapper<I, O> create(Function<I, O> function) { return new StreamMapper<>(function); } }
StreamMapper implements StreamTransformer<I, O> { public static <I, O> StreamMapper<I, O> create(Function<I, O> function) { return new StreamMapper<>(function); } private  StreamMapper(Function<I, O> function); }
StreamMapper implements StreamTransformer<I, O> { public static <I, O> StreamMapper<I, O> create(Function<I, O> function) { return new StreamMapper<>(function); } private  StreamMapper(Function<I, O> function); static StreamMapper<I, O> create(Function<I, O> function); @Override StreamConsumer<I> getInput(); @Override StreamSupplier<O> getOutput(); }
StreamMapper implements StreamTransformer<I, O> { public static <I, O> StreamMapper<I, O> create(Function<I, O> function) { return new StreamMapper<>(function); } private  StreamMapper(Function<I, O> function); static StreamMapper<I, O> create(Function<I, O> function); @Override StreamConsumer<I> getInput(); @Override StreamSupplier<O> getOutput();  }