TaskwarriorDatabase implements Database { @Override public void update(Task task) throws NotStoredException { if (task.uuid == null) throw new NotStoredException(); mTaskwarrior.modify(task.uuid, task.description, translateStatus(task.done)); } TaskwarriorDatabase(Parser parser, Taskwarrior taskwarrior, Translator translator); @Override Task[] select(); @Override void insert(Task task); @Override void update(Task task);  }
@Test(expected = Database.NotStoredException.class) public void updatingTaskWithoutUuidThrowsException() throws Exception { mDatabase.update(mTask); }
@Test public void updatesTask() throws Exception { mTask.uuid = "1234"; mTask.description = "updated!"; mDatabase.update(mTask); verify(mTaskwarrior, atLeastOnce()).modify(mTask.uuid, mTask.description, InternalTask.Status.Pending); mTask.done = true; mDatabase.update(mTask); verify(mTaskwarrior, atLeastOnce()).modify(mTask.uuid, mTask.description, InternalTask.Status.Completed); }