예제 #1
0
 /** TestCase 6.3 Test whether a new comment is correctly attached to its parent */
 public void testCommentAssociation() {
   TopicModel testTopic = new TopicModel();
   CommentModel testComment = new CommentModel();
   testTopic.addChildComment(testComment);
   testComment.setMyParent(testTopic);
   assertSame("Comment not properly associated with Topic", testComment.getMyParent(), testTopic);
 }
예제 #2
0
  /** TestCase 21.1 Test whether comment takes user and allows for username retreival */
  public void testCommentUser() {
    String theUserName = "******";
    UserModel user = new UserModel(theUserName);

    CommentModel comment = new CommentModel();
    comment.setPostedBy(user);

    assertEquals(theUserName, comment.getPostedBy().getUserName());
  }
예제 #3
0
 /** TestCase 13.1 Test whether a comment can be edited */
 public void testEditComment() {
   CommentModel testComment = new CommentModel();
   String string = "This is a test text";
   testComment.setCommentText(string);
   assertEquals("Check if comment is set before edit", string, testComment.getCommentText());
   String string1 = "Changed the text";
   testComment.setCommentText(string1);
   assertNotSame("Check if the edit occured", string, testComment.getCommentText());
 }