diff --git a/src/test/java/org/cactoos/func/AsyncFuncTest.java b/src/test/java/org/cactoos/func/AsyncFuncTest.java index 250f821b40..22d26d0411 100644 --- a/src/test/java/org/cactoos/func/AsyncFuncTest.java +++ b/src/test/java/org/cactoos/func/AsyncFuncTest.java @@ -23,6 +23,7 @@ */ package org.cactoos.func; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import org.cactoos.FuncApplies; @@ -52,7 +53,26 @@ public void runsInBackground() { new FuncApplies<>( true, new FuncAsMatcher>( - input -> !input.isDone() + future -> !future.isDone() + ) + ) + ); + } + + @Test + public void runsInBackgroundWithoutFuture() { + final CountDownLatch latch = new CountDownLatch(1); + MatcherAssert.assertThat( + "Can't run in the background without us touching the Future", + new AsyncFunc<>( + input -> { + latch.countDown(); + } + ), + new FuncApplies<>( + true, + new FuncAsMatcher>( + future -> latch.await(1L, TimeUnit.SECONDS) ) ) );