@Test public void testFunctionSupplierError() { StreamMapper<Integer, Integer> mapper = StreamMapper.create(input -> input * input); ExpectedException exception = new ExpectedException("Test Exception"); StreamSupplier<Integer> supplier = concat( StreamSupplier.of(1, 2, 3), StreamSupplier.of(4, 5, 6), StreamSupplier.closingWithError(exception)); StreamConsumerToList<Integer> consumer = StreamConsumerToList.create(); Throwable e = awaitException(supplier.transformWith(mapper) .streamTo(consumer)); assertSame(exception, e); assertEquals(asList(1, 4, 9, 16, 25, 36), consumer.getList()); 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();  }