};
// Create an exception handler that counts down latch when it's called
ThreadedTaskController.ExceptionHandler exceptionHandler =
new ThreadedTaskController.ExceptionHandler() {
public void handleException(Exception ex) {
failingTaskLatch.countDown();
}
};
// Check that a long task creates a visible dialog at screen
new ThreadedTaskController(failingTask, "Message", exceptionHandler, preferences, viewFactory).executeTask(null);
failingTaskLatch.await(1000, TimeUnit.MILLISECONDS);