@Test
public void testExecuteAsync() throws Exception
{

    // The "token" queue
    final BlockingQueue<String> queue = new LinkedBlockingQueue<>(1);
    // Schedule an asynchronous task
    herdThreadHelper.executeAsync(new Runnable()
    {
        public void run()
        {
            try
            {
                Thread.sleep(500);
                queue.offer("testToken");
            }
            catch (InterruptedException e)
            {
                throw new RuntimeException(e);
            }
        }
    });
    /*
     * Poll the queue, which blocks this thread.
     * For safety, a short timeout of 1 second is added, so in case of deadlock or other threading nightmares, this test doesn't block the rest of test
     * execution.
     * The token will be null if the timeout is reached, otherwise
     */
    String token = queue.poll(1000, TimeUnit.MILLISECONDS);
    Assert.assertNotNull("Expected the async task to have put a token in the queue, but none was found after a timeout. Ensure that the async task "
        + "actually ran and pushed a token into queue.", token);
}