String commentsUri = getUriBuilder(CommentsResource.class).build(getWiki(), SPACE_NAME, PAGE_NAME).toString();
GetMethod getMethod = executeGet(commentsUri);
Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());
Comments comments = (Comments) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());
int numberOfComments = comments.getComments().size();
NameValuePair[] nameValuePairs = new NameValuePair[1];
nameValuePairs[0] = new NameValuePair("text", "Comment");
PostMethod postMethod =
executePostForm(commentsUri, nameValuePairs, TestUtils.ADMIN_CREDENTIALS.getUserName(),
TestUtils.ADMIN_CREDENTIALS.getPassword());
Assert.assertEquals(getHttpMethodInfo(postMethod), HttpStatus.SC_CREATED, postMethod.getStatusCode());
getMethod = executeGet(commentsUri);
Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());
comments = (Comments) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());
Assert.assertEquals(numberOfComments + 1, comments.getComments().size());
}