@Override
 public void removeTask(LocalTask task) {
   if (task.isDefault()) return;
   if (myActiveTask.equals(task)) {
     activateTask(myTasks.get(LocalTaskImpl.DEFAULT_TASK_ID), true);
   }
   myTasks.remove(task.getId());
   myDispatcher.getMulticaster().taskRemoved(task);
   myContextManager.removeContext(task);
 }
 public void testCreateComment() throws Exception {
   myRepository.setShouldFormatCommitMessage(true);
   myRepository.setCommitMessageFormat("{id} {summary} {number} {project}");
   Task task = myRepository.findTask("TEST-001");
   assertNotNull(task);
   activateAndCreateChangelist(task);
   myChangeListManager.waitUntilRefreshed();
   LocalTask localTask = myTaskManager.getActiveTask();
   assertNotNull(localTask);
   assertEquals("TEST-001", localTask.getId());
   List<ChangeListInfo> lists = localTask.getChangeLists();
   assertEquals(1, lists.size());
   assertEquals("TEST-001 Summary 001 TEST", lists.get(0).comment);
 }
 @Override
 public void updateTimeSpent(final LocalTask task, final String timeSpent, final String comment)
     throws Exception {
   checkVersion();
   final HttpMethod method =
       doREST(
           "/rest/issue/execute/"
               + task.getId()
               + "?command=work+Today+"
               + timeSpent.replaceAll(" ", "+")
               + "+"
               + comment,
           true);
   if (method.getStatusCode() != 200) {
     InputStream stream = method.getResponseBodyAsStream();
     String message = new SAXBuilder(false).build(stream).getRootElement().getText();
     throw new Exception(message);
   }
 }
 @Override
 public void updateTimeSpent(final LocalTask task, final String timeSpent, final String comment)
     throws Exception {
   final HttpClient client = login();
   checkVersion(client);
   PostMethod method = new PostMethod(getUrl() + "/rest/api/2/issue/" + task.getId() + "/worklog");
   method.setRequestEntity(
       new StringRequestEntity(
           "{\"timeSpent\" : \""
               + timeSpent
               + "\""
               + (StringUtil.isNotEmpty(comment) ? ", \"comment\" : " + comment : "")
               + " }",
           "application/json",
           "UTF-8"));
   client.executeMethod(method);
   if (method.getStatusCode() != 201) {
     throw new Exception(method.getResponseBodyAsString());
   }
 }