public void testPOSTPageFormUrlEncoded() throws Exception
{
final String CONTENT = String.format("This is a content (%d)", System.currentTimeMillis());
final String TITLE = String.format("Title (%s)", UUID.randomUUID().toString());
Page originalPage = getFirstPage();
Link link = getFirstLinkByRelation(originalPage, Relations.SELF);
Assert.assertNotNull(link);
NameValuePair[] nameValuePairs = new NameValuePair[2];
nameValuePairs[0] = new NameValuePair("title", TITLE);
nameValuePairs[1] = new NameValuePair("content", CONTENT);
PostMethod postMethod =
executePostForm(String.format("%s?method=PUT", link.getHref()), nameValuePairs, "Admin", "admin");
Assert.assertEquals(getHttpMethodInfo(postMethod), HttpStatus.SC_ACCEPTED, postMethod.getStatusCode());
Page modifiedPage = (Page) unmarshaller.unmarshal(postMethod.getResponseBodyAsStream());
Assert.assertEquals(modifiedPage.getContent(), CONTENT);
Assert.assertEquals(modifiedPage.getTitle(), TITLE);
}