@Test
 public void should_update_task_direction() throws ResourceNotFoundException {
   Task task = rule.client().createTask(new Task("from the api!", Task.Type.todo));
   assertThat(rule.client().getTask(task.getId()).getDirection()).isEqualTo(Task.Direction.up);
   Answer answer = rule.client().updateTaskDirection(task.getId(), Task.Direction.down);
   assertThat(answer).isNotNull();
 }
  @Test
  public void should_create_task() {
    Task task = rule.client().createTask(new Task("from the api!", Task.Type.todo));

    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()).isFalse();
  }
  @Test(expected = ResourceNotFoundException.class)
  public void should_delete_task() throws ResourceNotFoundException {
    Task task = rule.client().createTask(new Task("from the api!", Task.Type.todo));

    rule.client().deleteTask(task.getId());

    rule.client().getTask(task.getId());
  }
  @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);
  }
  @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);
  }
  @Test
  public void should_get_task_by_id() throws ResourceNotFoundException {
    Task task1 = rule.client().createTask(new Task("from the api!", Task.Type.todo));

    assertThat(rule.client().getTask(task1.getId())).isEqualTo(task1);
  }