{
final String title = String.format("Title (%s)", UUID.randomUUID().toString());
final String content = String.format("This is a content (%d)", System.currentTimeMillis());
final String comment = String.format("Updated title and content (%d)", System.currentTimeMillis());
Page originalPage = getFirstPage();
Page newPage = objectFactory.createPage();
newPage.setTitle(title);
newPage.setContent(content);
newPage.setComment(comment);
Link link = getFirstLinkByRelation(originalPage, Relations.SELF);
Assert.assertNotNull(link);
// PUT
PutMethod putMethod =
executePutXml(link.getHref(), newPage, TestUtils.ADMIN_CREDENTIALS.getUserName(),
TestUtils.ADMIN_CREDENTIALS.getPassword());
Assert.assertEquals(getHttpMethodInfo(putMethod), HttpStatus.SC_ACCEPTED, putMethod.getStatusCode());
Page modifiedPage = (Page) unmarshaller.unmarshal(putMethod.getResponseBodyAsStream());
Assert.assertEquals(title, modifiedPage.getTitle());
Assert.assertEquals(content, modifiedPage.getContent());
Assert.assertEquals(comment, modifiedPage.getComment());
// GET
GetMethod getMethod = executeGet(link.getHref());
Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());
modifiedPage = (Page) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());
Assert.assertEquals(title, modifiedPage.getTitle());
Assert.assertEquals(content, modifiedPage.getContent());
Assert.assertEquals(comment, modifiedPage.getComment());
}