Skip to content

Commit

Permalink
Add some tests to Comment
Browse files Browse the repository at this point in the history
  • Loading branch information
PashaBarahimi committed Oct 24, 2023
1 parent 9d47a54 commit a811fa6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/test/java/model/CommentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,25 @@ public void testMultipleUserMultipleLike_hasCorrectValue(int count) {
}
Assertions.assertEquals(count, comment.getLike());
}

@ParameterizedTest
@ValueSource(ints = {2, 4, 7})
@DisplayName("Test multiple users giving multiple dislikes")
public void testMultipleUserMultipleDislike_hasCorrectValue(int count) {
for (int i = 0; i < count; i++) {
comment.addUserVote("person" + i, "dislike");
}
Assertions.assertEquals(count, comment.getDislike());
}

@Test
@DisplayName("Test multiple users giving multiple likes and dislikes")
public void testMultipleUserMultipleLikeAndDislike_hasCorrectValue() {
comment.addUserVote("good_person1", "like");
comment.addUserVote("bad_person1", "dislike");
comment.addUserVote("good_person2", "like");
comment.addUserVote("bad_person2", "dislike");
Assertions.assertEquals(2, comment.getLike());
Assertions.assertEquals(2, comment.getDislike());
}
}

0 comments on commit a811fa6

Please sign in to comment.