(Callable<Task<?>> callable)
| 23 | |
| 24 | public class TaskTest extends TestCase { |
| 25 | private void runTaskTest(Callable<Task<?>> callable) { |
| 26 | try { |
| 27 | Task<?> task = callable.call(); |
| 28 | task.waitForCompletion(); |
| 29 | if (task.isFaulted()) { |
| 30 | Exception error = task.getError(); |
| 31 | if (error instanceof RuntimeException) { |
| 32 | throw (RuntimeException) error; |
| 33 | } |
| 34 | throw new RuntimeException(error); |
| 35 | } else if (task.isCancelled()) { |
| 36 | throw new RuntimeException(new CancellationException()); |
| 37 | } |
| 38 | } catch (Exception e) { |
| 39 | throw new RuntimeException(e); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | public void testPrimitives() { |
| 44 | Task<Integer> complete = Task.forResult(5); |
no test coverage detected