@Test
public void submitIsAsynchronous() throws Exception {

    final long timeout = 5000;
    final long testedCount = timeout / 5;
    Callable<Boolean> task = new Callable<Boolean>() {
        @Override
        public Boolean call() throws Exception {
            Thread.sleep(timeout);
            return false;
        }
    };
    final CountDownLatch latch = new CountDownLatch(1);
    Callback<Boolean> callback = new Callback<Boolean>() {
        @Override
        public void onSuccess(Boolean data) {
            latch.countDown();
        }
        @Override
        public void onFailure(Exception e) {
        }
    };
    Future<AsyncResult<Boolean>> resultFuture = AsyncRunner.submit(callback, task);
    long count = 0;
    while (latch.getCount() > 0) {
        count++;
        Thread.sleep(1);
    }
    AsyncResult<Boolean> result = resultFuture.get();
    assertThat(result.getData(), is(false));
    assertThat(count, greaterThanOrEqualTo(testedCount));
}