()
| 385 | } |
| 386 | |
| 387 | public void testOnSuccess() { |
| 388 | Continuation<Integer, Integer> continuation = new Continuation<Integer, Integer>() { |
| 389 | public Integer then(Task<Integer> task) { |
| 390 | return task.getResult().intValue() + 1; |
| 391 | } |
| 392 | }; |
| 393 | Task<Integer> complete = Task.forResult(5).onSuccess(continuation); |
| 394 | Task<Integer> error = Task.<Integer> forError(new IllegalStateException()).onSuccess( |
| 395 | continuation); |
| 396 | Task<Integer> cancelled = Task.<Integer> cancelled().onSuccess(continuation); |
| 397 | |
| 398 | assertTrue(complete.isCompleted()); |
| 399 | assertEquals(6, complete.getResult().intValue()); |
| 400 | assertFalse(complete.isFaulted()); |
| 401 | assertFalse(complete.isCancelled()); |
| 402 | |
| 403 | assertTrue(error.isCompleted()); |
| 404 | assertTrue(error.getError() instanceof RuntimeException); |
| 405 | assertTrue(error.isFaulted()); |
| 406 | assertFalse(error.isCancelled()); |
| 407 | |
| 408 | assertTrue(cancelled.isCompleted()); |
| 409 | assertFalse(cancelled.isFaulted()); |
| 410 | assertTrue(cancelled.isCancelled()); |
| 411 | } |
| 412 | |
| 413 | public void testOnSuccessTask() { |
| 414 | Continuation<Integer, Task<Integer>> continuation = new Continuation<Integer, Task<Integer>>() { |
nothing calls this directly
no test coverage detected