public void testOnSuccess()

in BoltsTest/src/bolts/TaskTest.java [387:411]


  public void testOnSuccess() {
    Continuation<Integer, Integer> continuation = new Continuation<Integer, Integer>() {
      public Integer then(Task<Integer> task) {
        return task.getResult().intValue() + 1;
      }
    };
    Task<Integer> complete = Task.forResult(5).onSuccess(continuation);
    Task<Integer> error = Task.<Integer> forError(new IllegalStateException()).onSuccess(
        continuation);
    Task<Integer> cancelled = Task.<Integer> cancelled().onSuccess(continuation);

    assertTrue(complete.isCompleted());
    assertEquals(6, complete.getResult().intValue());
    assertFalse(complete.isFaulted());
    assertFalse(complete.isCancelled());

    assertTrue(error.isCompleted());
    assertTrue(error.getError() instanceof RuntimeException);
    assertTrue(error.isFaulted());
    assertFalse(error.isCancelled());

    assertTrue(cancelled.isCompleted());
    assertFalse(cancelled.isFaulted());
    assertTrue(cancelled.isCancelled());
  }