Blocking { public static Runnable runnable(Runnable runnable) { return () -> supplier(() -> { runnable.run(); return null; }).get(); } private  Blocking(); static Runnable runnable(Runnable runnable); static BiConsumer<T, U> biConsumer(BiConsumer<? super T, ? super U> biConsumer); static BiFunction<T, U, R> biFunction(BiFunction<? super T, ? super U, ? extends R> biFunction); static BiPredicate<T, U> biPredicate(BiPredicate<? super T, ? super U> biPredicate); static BinaryOperator<T> binaryOperator(BinaryOperator<T> binaryOperator); static BooleanSupplier booleanSupplier(BooleanSupplier booleanSupplier); static Consumer<T> consumer(Consumer<? super T> consumer); static DoubleBinaryOperator doubleBinaryOperator(DoubleBinaryOperator doubleBinaryOperator); static DoubleConsumer doubleConsumer(DoubleConsumer doubleConsumer); static DoubleFunction<R> doubleFunction(DoubleFunction<? extends R> doubleFunction); static DoublePredicate doublePredicate(DoublePredicate doublePredicate); static DoubleSupplier doubleSupplier(DoubleSupplier doubleSupplier); static DoubleToIntFunction doubleToIntFunction(DoubleToIntFunction doubleToIntFunction); static DoubleToLongFunction doubleToLongFunction(DoubleToLongFunction doubleToLongFunction); static DoubleUnaryOperator doubleUnaryOperator(DoubleUnaryOperator doubleUnaryOperator); static Function<T, R> function(Function<? super T, ? extends R> function); static IntBinaryOperator intBinaryOperator(IntBinaryOperator intBinaryOperator); static IntConsumer intConsumer(IntConsumer intConsumer); static IntFunction<R> intFunction(IntFunction<? extends R> intFunction); static IntPredicate intPredicate(IntPredicate intPredicate); static IntSupplier intSupplier(IntSupplier intSupplier); static IntToDoubleFunction intToDoubleFunction(IntToDoubleFunction intToDoubleFunction); static IntToLongFunction intToLongFunction(IntToLongFunction intToLongFunction); static IntUnaryOperator intUnaryOperator(IntUnaryOperator intUnaryOperator); static LongBinaryOperator longBinaryOperator(LongBinaryOperator longBinaryOperator); static LongConsumer longConsumer(LongConsumer longConsumer); static LongFunction<R> longFunction(LongFunction<? extends R> longFunction); static LongPredicate longPredicate(LongPredicate longPredicate); static LongSupplier longSupplier(LongSupplier longSupplier); static LongToDoubleFunction longToDoubleFunction(LongToDoubleFunction longToDoubleFunction); static LongToIntFunction longToIntFunction(LongToIntFunction longToIntFunction); static LongUnaryOperator longUnaryOperator(LongUnaryOperator longUnaryOperator); static ObjDoubleConsumer<T> objDoubleConsumer(ObjDoubleConsumer<T> objDoubleConsumer); static ObjIntConsumer<T> objIntConsumer(ObjIntConsumer<T> objIntConsumer); static ObjLongConsumer<T> objLongConsumer(ObjLongConsumer<T> objLongConsumer); static Predicate<T> predicate(Predicate<? super T> predicate); static Supplier<T> supplier(Supplier<? extends T> supplier); static ToDoubleBiFunction<T, U> toDoubleBiFunction(ToDoubleBiFunction<? super T, ? super U> toDoubleBiFunction); static ToDoubleFunction<T> toDoubleFunction(ToDoubleFunction<? super T> toDoubleFunction); static ToIntBiFunction<T, U> toIntBiFunction(ToIntBiFunction<? super T, ? super U> toIntBiFunction); static ToIntFunction<T> toIntFunction(ToIntFunction<? super T> toIntFunction); static ToLongBiFunction<T, U> toLongBiFunction(ToLongBiFunction<? super T, ? super U> toLongBiFunction); static ToLongFunction<T> toLongFunction(ToLongFunction<? super T> toLongFunction); static UnaryOperator<T> unaryOperator(UnaryOperator<T> unaryOperator);  }
@Test public void testRunnable_run() { AtomicBoolean executed = new AtomicBoolean(false); Runnable runnable = Blocking.runnable(() -> executed.set(true)); CompletableFuture.runAsync(runnable, pool) .join(); Assert.assertTrue("The given runnable has not been executed", executed.get()); }