Once extends TimerTask { public static void after(Duration delay, Runnable runnable) { new Once(runnable, delay); } private  Once(Runnable runnable, Duration delay); static void after(Duration delay, Runnable runnable); @Override void run();  }
@Test(timeout = 60_000) public void test_run() throws Exception { CountDownLatch latch = new CountDownLatch(1); Once.after(Duration.ZERO, latch::countDown); assertTrue(latch.await(30, TimeUnit.SECONDS)); }