taskService.saveTask(task);
String taskId = task.getId();
identityService.setAuthenticatedUserId("johndoe");
// Fetch the task again and update
taskService.createAttachment("web page", taskId, "someprocessinstanceid", "weatherforcast", "temperatures and more", "http://weather.com");
Attachment attachment = taskService.getTaskAttachments(taskId).get(0);
assertEquals("weatherforcast", attachment.getName());
assertEquals("temperatures and more", attachment.getDescription());
assertEquals("web page", attachment.getType());
assertEquals(taskId, attachment.getTaskId());
assertEquals("someprocessinstanceid", attachment.getProcessInstanceId());
assertEquals("http://weather.com", attachment.getUrl());
assertNull(taskService.getAttachmentContent(attachment.getId()));
// Finally, clean up
taskService.deleteTask(taskId);
assertEquals(0, taskService.getTaskComments(taskId).size());