Ejemplo n.º 1
0
  /**
   * Tests that listeners are not fired when a cloned comment is approved. Why? Because manipulating
   * comments from a blog entry decorator will generate excess events if not disabled.
   */
  public void testListenersNotFiredWhenCommentApprovedOnClone() {
    comment.setPending();
    comment = (Comment) comment.clone();

    CommentListener listener =
        new CommentListener() {
          public void commentAdded(CommentEvent event) {
            fail();
          }

          public void commentRemoved(CommentEvent event) {
            fail();
          }

          public void commentApproved(CommentEvent event) {
            fail();
          }

          public void commentRejected(CommentEvent event) {
            fail();
          }
        };

    blog.getEventListenerList().addCommentListener(listener);
    comment.setApproved();
  }
Ejemplo n.º 2
0
  /** 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());
  }