taskService.saveTask(task);
String taskId = task.getId();
// Fetch the task again and update
// add attachment
Attachment attachment = taskService.createAttachment("web page", taskId, "someprocessinstanceid", "weatherforcast", "temperatures and more", "http://weather.com");
String attachmentId = attachment.getId();
// get attachment for taskId and attachmentId
attachment = taskService.getTaskAttachment(taskId, attachmentId);
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()));
// delete attachment for taskId and attachmentId
taskService.deleteTaskAttachment(taskId, attachmentId);
// check if attachment deleted