@Test
public void createUpdateAndDeleteTask() {
// create
Task task = randomTask();
URI createdTaskUri = restTemplate.postForLocation(resourceUrl, task);
System.out.println(createdTaskUri.toString());
Task createdTask = restTemplate.getForObject(createdTaskUri, Task.class);
assertThat(createdTask.getTitle()).isEqualTo(task.getTitle());
// update
String id = StringUtils.substringAfterLast(createdTaskUri.toString(), "/");
task.setId(new Long(id));
task.setTitle(RandomData.randomName("Task"));
restTemplate.put(createdTaskUri, task);
Task updatedTask = restTemplate.getForObject(createdTaskUri, Task.class);
assertThat(updatedTask.getTitle()).isEqualTo(task.getTitle());
// delete
restTemplate.delete(createdTaskUri);
Task deletedTask = restTemplate.getForObject(createdTaskUri, Task.class);
assertThat(deletedTask).isNull();
}