/** Tests that the date can never be null. */ public void testDate() { assertNotNull(comment.getDate()); comment.setDate(new Date()); assertNotNull(comment.getDate()); comment.setDate(null); assertNotNull(comment.getDate()); }
/** 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()); }
/** 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()); }
/** * Delete a comment from a song. * * @param authorId The author of the song. */ public void deleteComment(String authorId, Date date) { for (Comment comment : comments) { if (comment.getAuthor().equals(authorId) && comment.getDate().equals(date)) { comments.remove(comment); return; } } }
public boolean equalsComment(Comment c) { if (c.getCommenter().equals(commenter)) { if (c.getComment().equals(comment)) { if (c.getDate().equals(date)) { return true; } } } return false; }