StreamUtil { public static <X> Function<X, X> toFunction(final Consumer<X> f) { return x -> { f.accept(x); return x; }; } private  StreamUtil(); static Stream<T> toStream(final Iterable<T> loader); static Function<X, X> toFunction(final Consumer<X> f);  }
@Test void toFunction() { final String tested = UUID.randomUUID() .toString(); final Function<String, String> f = StreamUtil.toFunction(consumer); assertThat(f.apply(tested)).isEqualTo(tested); verify(consumer).accept(eq(tested)); }