hemanth0525 commented on code in PR #537:
URL:
https://github.com/apache/commons-collections/pull/537#discussion_r1740120069
##########
src/test/java/org/apache/commons/collections4/ListUtilsTest.java:
##########
@@ -102,6 +102,54 @@ public void testEquals() {
assertFalse(ListUtils.isEqualList(list1, list2));
}
+ @Test
+ public void testFindDuplicatesWithDuplicates() {
+ List<Integer> input = Arrays.asList(1, 2, 3, 2, 4, 5, 3);
+ List<Integer> expected = Arrays.asList(2, 3);
+ List<Integer> actual = ListUtils.findDuplicates(input);
+ assertEquals(expected, actual, "The list should contain only the
duplicate elements.");
+ }
+
+ @Test
+ public void testFindDuplicatesNoDuplicates() {
+ List<Integer> input = Arrays.asList(1, 2, 3, 4, 5);
+ List<Integer> expected = Arrays.asList();
+ List<Integer> actual = ListUtils.findDuplicates(input);
+ assertEquals(expected, actual, "The list should be empty as there are
no duplicates.");
+ }
+
+ @Test
+ public void testFindDuplicatesEmptyList() {
+ List<Integer> input = Arrays.asList();
+ List<Integer> expected = Arrays.asList();
+ List<Integer> actual = ListUtils.findDuplicates(input);
+ assertEquals(expected, actual, "The list should be empty as the input
list is empty.");
+ }
+
+ @Test
+ public void testFindDuplicatesSingleElement() {
+ List<Integer> input = Arrays.asList(1);
+ List<Integer> expected = Arrays.asList();
+ List<Integer> actual = ListUtils.findDuplicates(input);
+ assertEquals(expected, actual, "The list should be empty as there is
only one element.");
Review Comment:
tests for CollectionUtils are written in CollectionUtilsTest.java right. do
we still we gotta change the method name here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]