assertTrue(future.isDone());
}
public void testImmediateExecution() {
Promise p=new Promise();
ImmediateTask task=new ImmediateTask(p);
timer.execute(task);
try {
long start=System.currentTimeMillis(), stop;
p.getResultWithTimeout(5);
stop=System.currentTimeMillis();
System.out.println("task took " + (stop-start) + "ms");
}
catch(TimeoutException e) {
fail("ran into timeout - task should have executed immediately");