/** Tests that a comment can be cloned. */ public void testClone() { Comment clonedComment = (Comment) comment.clone(); assertEquals(comment.getTitle(), clonedComment.getTitle()); assertEquals(comment.getBody(), clonedComment.getBody()); assertEquals(comment.getWebsite(), clonedComment.getWebsite()); assertEquals(comment.getAvatar(), clonedComment.getAvatar()); assertEquals(comment.getAuthor(), clonedComment.getAuthor()); assertEquals(comment.getIpAddress(), clonedComment.getIpAddress()); assertEquals(comment.getDate(), clonedComment.getDate()); assertEquals(comment.getId(), clonedComment.getId()); assertEquals(comment.getState(), clonedComment.getState()); assertEquals(comment.getParent(), clonedComment.getParent()); assertEquals(comment.getBlogEntry(), clonedComment.getBlogEntry()); }
/** Tests the various states for a comment. */ public void testStates() { // the default is approved assertEquals(State.APPROVED, comment.getState()); assertTrue(comment.isApproved()); assertFalse(comment.isPending()); assertFalse(comment.isRejected()); comment.setPending(); assertEquals(State.PENDING, comment.getState()); assertFalse(comment.isApproved()); assertTrue(comment.isPending()); assertFalse(comment.isRejected()); comment.setRejected(); assertEquals(State.REJECTED, comment.getState()); assertFalse(comment.isApproved()); assertFalse(comment.isPending()); assertTrue(comment.isRejected()); }
/** Test that a Comment instance can be created correctly. */ public void testConstructionOfSimpleInstance() { assertNotNull(comment); assertEquals("Title", comment.getTitle()); assertEquals("Body", comment.getBody()); assertEquals("Author", comment.getAuthor()); assertEquals("*****@*****.**", comment.getEmail()); assertEquals("http://www.google.com", comment.getWebsite()); assertEquals("http://graph.facebook.com/user/picture", comment.getAvatar()); assertEquals("127.0.0.1", comment.getIpAddress()); assertNotNull(comment.getDate()); assertEquals(comment.getDate().getTime(), comment.getId()); assertNotNull(comment.getBlogEntry()); assertEquals(State.APPROVED, comment.getState()); assertEquals("c/" + comment.getBlogEntry().getId() + "/" + comment.getId(), comment.getGuid()); }