class AsyncRunner {

    public static <RESULT> RESULT run(Callable<RESULT> task) throws ExecutionException, InterruptedException {
        return submit(null, task).get().unwrap();
    }

}

class AsyncRunnerTest {

    @Rule
    public ExpectedException exception;

    @Test
    public void runIsSynchronous() throws Exception {

        final long timeout = 5000;

        Callable<Boolean> task = new Callable<Boolean>() {
            @Override
            public Boolean call() throws Exception {
                Thread.sleep(timeout);
                return false;
            }
        };

        long startTime = System.currentTimeMillis();

        Boolean result = AsyncRunner.run(task);

        long endTime = System.currentTimeMillis();

        assertThat(result, is(false));
        assertThat(endTime - startTime, greaterThanOrEqualTo(timeout));
    }

}