コード例 #1
0
  @Test
  public void should_update_task() {
    Task task =
        rule.client()
            .createTask(
                new Task(
                    "from the api!",
                    Task.Type.todo,
                    1,
                    "notes",
                    Task.Status.COMPLETED,
                    Task.Direction.down));

    task =
        rule.client()
            .updateTask(
                task.getId(),
                new Task(
                    "from the api! EDITED",
                    Task.Type.daily,
                    2,
                    "notes EDITED",
                    Task.Status.INCOMPLETE,
                    Task.Direction.up));

    assertThat(task.isCompleted()).isFalse();
    assertThat(task.getNotes()).isEqualTo("notes EDITED");
    assertThat(task.getDirection()).isEqualTo(Task.Direction.up);
    assertThat(task.getText()).isEqualTo("from the api! EDITED");
    //        assertThat(task.getType()).isEqualTo(Task.Type.daily);
    assertThat(task.getValue()).isEqualTo(2);
  }
コード例 #2
0
  @Test
  public void should_create_task_with_optional() {
    Task task =
        rule.client()
            .createTask(
                new Task(
                    "from the api!",
                    Task.Type.todo,
                    1,
                    "notes",
                    Task.Status.COMPLETED,
                    Task.Direction.down));

    assertThat(task.getId())
        .matches("[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}");
    assertThat(task.isCompleted()).isTrue();
    assertThat(task.getNotes()).isEqualTo("notes");
    assertThat(task.getDirection()).isEqualTo(Task.Direction.down);
  }